Reference Guide
GdPicture14 Namespace / GdPictureImaging Class / PrintSetActivePrinter Method
The name of the printer you want to set up as an active printer to be used for subsequent printing.
Example





In This Topic
    PrintSetActivePrinter Method (GdPictureImaging)
    In This Topic
    Sets the printer, identified by its name, as the active printer, in other words makes it the currently selected printer, which is subsequently used when printing. The specified printer is used to execute all next print jobs using the print methods of this class, if not set otherwise, without affecting any other installed printers.

    You can use the PrintGetActivePrinter method to retrieve the currently selected printer, denoted as the active printer for print methods of this class. At the same this printer utilizes all by you altered printer settings without affecting the installed printers.

    Syntax
    'Declaration
     
    
    Public Function PrintSetActivePrinter( _
       ByVal PrinterName As String _
    ) As Boolean
    public bool PrintSetActivePrinter( 
       string PrinterName
    )
    public function PrintSetActivePrinter( 
        PrinterName: String
    ): Boolean; 
    public function PrintSetActivePrinter( 
       PrinterName : String
    ) : boolean;
    public: bool PrintSetActivePrinter( 
       string* PrinterName
    ) 
    public:
    bool PrintSetActivePrinter( 
       String^ PrinterName
    ) 

    Parameters

    PrinterName
    The name of the printer you want to set up as an active printer to be used for subsequent printing.

    Return Value

    true if the method has been followed successfully, otherwise false.

    Please use the GetStat method or the PrintGetStat method to determine the specific reason for the method's failure.

    Remarks
    Just to inform you that the printer selected 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
    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