[Mono-dev] Get list of installed printers
Daniel Morgan
danielmorgan at verizon.net
Sat Dec 31 13:49:11 EST 2005
If you can wait until the next release of Mono, it will have some
limited System.Drawing.Printing support.
Windows will use Win32 GDI while Unix-like systems will use CUPS. Or
you can get it from Mono's subversion repository.
http://www.mono-project.com/AnonSVN
There are some alternatives to System.Drawing.Printing:
1. GnomePrint# which is part of GTK#. It works well on Unix-like
systems, but it seems to draw a mirror of what it should on Win32.
Win32 implementation of GnomePrint uses GDI.
There is a PrintSample.cs included in gtk# that shows you how to use
GnomePrint#.
2. wx.net has printing support. They have a Printing sample that shows
you how to do printing in wx.net. wx.net is available on Win32 and Linux.
http://wxnet.sourceforge.net/
3. Draw to a PDF. Let your PDF reader print the PDF to a printer if you
need it to be printed. Most things these days don't get printed but get
put into a PDF for online viewing. There are plenty of .net APIs on
sourceforge which will let you do this.
http://sourceforge.net/projects/itext
gigi gogu wrote:
> Hy there again,
>
> any ideeas in how can I retreive the list of printers installed on a
> system?
> In Windows.Forms was easy:
>
> using System;
> using System.Drawing.Printing;
> ...
> ComboBox cmbPrinters=ComboBox.NewText();
> ...
> private void loadPrinters(){
> int nr=PrinterSettings.InstalledPrinters.Count;
> for (int i = 0; i < nr; i++)
> {
> string printer=PrinterSettings.InstalledPrinters[i];
> cmbPrinters.AppendText(printer);
> }
> }
>
> But in mono i get this error:
> Unhandled Exception: System.NotImplementedException: The req uested
> feature is not implemented.
> in [0x00005] (at
> /tmp/scratch/BUILD/mono-1.1.12/mcs/class/System.Drawing/System.Drawing.Printing/PrinterSettings.cs:272)
> System.Drawing.Printing.PrinterSettings:get_InstalledPrinters ()
> ....
>
> Is there another way to get the installed printers?
> My mono version is 1.1.12_0.
>
> Dantes.
> P.S. A happy new year for all mono-developers! :P
>
> ------------------------------------------------------------------------
More information about the Mono-devel-list
mailing list