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.
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