GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / PrintGetActivePrinter Method
Example





In This Topic
PrintGetActivePrinter Method (GdPictureImaging)
In This Topic
Returns the name of the printer, that is currently selected as the active printer, means the printer, which is subsequently used when printing.

It is mostly the default printer, if not set otherwise. Hovewer, you can use the PrintSetActivePrinter method to select your preferred printer for next print jobs without affecting any other installed printers.

Syntax
'Declaration
 
Public Function PrintGetActivePrinter() As String
public string PrintGetActivePrinter()
public function PrintGetActivePrinter(): String; 
public function PrintGetActivePrinter() : String;
public: string* PrintGetActivePrinter(); 
public:
String^ PrintGetActivePrinter(); 

Return Value

The name of the active printer to be used for subsequent printing.
Remarks
It is recommend to use the GetStat method or the PrintGetStat method to identify the specific reason for the method's failure, if any.

Just to inform you that the printer, which name is returned by this method, is used to execute all subsequent print jobs and all subsequently altered printer settings are related to this printer. Likewise, none of the available printers or their properties are affected using any of the print methods of this class.

Example
Controling the currently selected printer.
Finding out the name of the active printer.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    string name = gdpictureImaging.PrintGetActivePrinter();
    Console.WriteLine("Default printer name: {0}", name);
}
Changing the active printer.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int printCount = gdpictureImaging.PrintGetPrintersCount();
    string message = "The number of printers: " + printCount;
    if (printCount > 0)
    {
        gdpictureImaging.PrintSetActivePrinter(gdpictureImaging.PrintGetPrinterName(1));
        message += "\nThe active printer is: " + gdpictureImaging.PrintGetActivePrinter();
    }
    MessageBox.Show(message, "Active printer", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
See Also