GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / PrintGetDuplexMode Method
Example





In This Topic
PrintGetDuplexMode Method (GdPicturePDF)
In This Topic
Returns the printer duplex mode setting of the active printer. This property determines whether a page is printed on both sides (if the printer supports this feature).
Syntax
'Declaration
 
Public Function PrintGetDuplexMode() As Duplex
public Duplex PrintGetDuplexMode()
public function PrintGetDuplexMode(): Duplex; 
public function PrintGetDuplexMode() : Duplex;
public: Duplex PrintGetDuplexMode(); 
public:
Duplex PrintGetDuplexMode(); 

Return Value

A member of the Duplex enumeration. The value of the active printer duplex mode setting.

The GetStat method can be subsequently used or the PrintGetStat method to determine if this method has been successful.

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 remind you that the active printer is the printer identified by the PrintGetActivePrinter method or set by the PrintSetActivePrinter method and it is dedicated to executing all subsequent print jobs using this class as well as utilizing all by you altered printer settings.

Example
How to find out some properties of the active printer.
Dim caption As String = "Example: PrintGetDuplexMode"
Dim gdpicturePDF As New GdPicturePDF()
Dim message As String = ""
If (gdpicturePDF.LoadFromFile("document_to_print.pdf", False) = GdPictureStatus.OK) Then
    Dim curPrinter As String = gdpicturePDF.PrintGetActivePrinter()
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        message = "Active printer: " + curPrinter + vbCrLf
    Else
        message = "The PrintGetActivePrinter() method has failed with the status: " + gdpicturePDF.GetStat()
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        Dim prnAlign As PrintAlignment = gdpicturePDF.PrintGetAlignment()
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    alignment: " + prnAlign.ToString() + vbCrLf
        Else
            message = "The PrintGetAlignment() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        Dim prnCollate As Boolean = gdpicturePDF.PrintGetCollate()
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    collate: " + prnCollate.ToString() + vbCrLf
        Else
            message = "The PrintGetCollate() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        Dim prnColorMode As PrinterColorMode = gdpicturePDF.PrintGetColorMode()
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    color mode: " + prnColorMode.ToString() + vbCrLf
        Else
            message = "The PrintGetColorMode() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        Dim prnDuplex As System.Drawing.Printing.Duplex = gdpicturePDF.PrintGetDuplexMode()
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    duplex: " + prnDuplex.ToString() + vbCrLf
        Else
            message = "The PrintGetDuplexMode() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        Dim prnOrientation As PrinterOrientation = gdpicturePDF.PrintGetOrientation()
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    orientation: " + prnOrientation.ToString() + vbCrLf
        Else
            message = "The PrintGetOrientation() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        Dim prnQuality As PrintQuality = gdpicturePDF.PrintGetQuality()
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    quality: " + prnQuality.ToString() + vbCrLf
        Else
            message = "The PrintGetQuality() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() <> GdPictureStatus.OK Then
        message = "The example has NOT been followed successfully. Status: " + gdpicturePDF.GetStat().ToString()
    End If
Else
    message = "The file can't be loaded. Status: " + gdpicturePDF.GetStat().ToString()
End If
MessageBox.Show(message, caption)
gdpicturePDF.Dispose()
string caption = "Example: PrintGetDuplexMode";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
string message = "";
if (gdpicturePDF.LoadFromFile("document_to_print.pdf", false) == GdPictureStatus.OK)
{
    string curPrinter = gdpicturePDF.PrintGetActivePrinter();
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
        message = "Active printer: " + curPrinter + "\n";
    else
        message = "The PrintGetActivePrinter() method has failed with the status: " + gdpicturePDF.GetStat();
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        PrintAlignment prnAlign = gdpicturePDF.PrintGetAlignment();
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    alignment: " + prnAlign.ToString() + "\n";
        else
            message = "The PrintGetAlignment() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        bool prnCollate = gdpicturePDF.PrintGetCollate();
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    collate: " + prnCollate.ToString() + "\n";
        else
            message = "The PrintGetCollate() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        PrinterColorMode prnColorMode = gdpicturePDF.PrintGetColorMode();
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    color mode: " + prnColorMode.ToString() + "\n";
        else
            message = "The PrintGetColorMode() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        System.Drawing.Printing.Duplex prnDuplex = gdpicturePDF.PrintGetDuplexMode();
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    duplex: " + prnDuplex.ToString() + "\n";
        else
            message = "The PrintGetDuplexMode() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        PrinterOrientation prnOrientation = gdpicturePDF.PrintGetOrientation();
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    orientation: " + prnOrientation.ToString() + "\n";
        else
            message = "The PrintGetOrientation() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        PrintQuality prnQuality = gdpicturePDF.PrintGetQuality();
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    quality: " + prnQuality.ToString() + "\n";
        else
            message = "The PrintGetQuality() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() != GdPictureStatus.OK)
    {
        message = "The example has NOT been followed successfully. Status: " + gdpicturePDF.GetStat().ToString();
    }
}
else
{
    message = "The file can't be loaded. Status: " + gdpicturePDF.GetStat().ToString();
}
MessageBox.Show(message, caption);
gdpicturePDF.Dispose();
See Also