GdPicture.NET Reference Guide
PrintGetActivePrinter Method (GdViewer)
Example 





GdPicture14.WPF Namespace > GdViewer Class : PrintGetActivePrinter Method
Returns the name of the printer, that is currently selected as the active printer, means the printer, which is subsequently used when printing the document displayed in the GdViewer control.

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. Please always use the GetStat method or the PrintGetStat method to determine if this method has been successful.
Remarks
We strongly recommend using the GetStat method or the PrintGetStat method to identify the specific reason for the method's failure.

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
How to find out the name of the currently selected printer on your computer.
'We assume that the GdViewer1 control has been properly integrated.
Dim PrintersCount As Integer = GdViewer1.PrintGetPrintersCount()
If GdViewer1.GetStat() = GdPictureStatus.OK Then
    Dim CurPrinter As String = GdViewer1.PrintGetActivePrinter()
    If GdViewer1.GetStat() = GdPictureStatus.OK Then
        MessageBox.Show("The number of available printers: " + PrintersCount.ToString() + vbCrLf + "The currently selected printer is: " + CurPrinter, "GdViewer.PrintGetActivePrinter")
    Else
        MessageBox.Show("The PrintGetActivePrinter() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintGetActivePrinter")
    End If
Else
    MessageBox.Show("The PrintGetPrintersCount() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintGetActivePrinter")
End If
//We assume that the GdViewer1 control has been properly integrated.
int PrintersCount = GdViewer1.PrintGetPrintersCount();
if (GdViewer1.GetStat() == GdPictureStatus.OK)
{
    string CurPrinter = GdViewer1.PrintGetActivePrinter();
    if (GdViewer1.GetStat() == GdPictureStatus.OK)
        MessageBox.Show("The number of available printers: " + PrintersCount.ToString() +
                        "\nThe currently selected printer is: " + CurPrinter, "GdViewer.PrintGetActivePrinter");
    else
        MessageBox.Show("The PrintGetActivePrinter() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintGetActivePrinter");
}
else
    MessageBox.Show("The PrintGetPrintersCount() method has failed with the status: " + GdViewer1.PrintGetStat(), "GdViewer.PrintGetActivePrinter");
See Also

Reference

GdViewer Class
GdViewer Members
PrintSetActivePrinter Method
PrintGetPrintersCount Method
PrintGetPrinterName Method
PrintGetStat Method
Print Method