GdPicture.NET.14
GdPicture14 Namespace / GdPicturePDF Class / PrintSetQuality Method
A member of the PrintQuality enumeration. The new value of the active printer quality setting.
Example





In This Topic
PrintSetQuality Method (GdPicturePDF)
In This Topic
Sets up the printer quality setting of the active printer. This setting matches the PrinterResolutionKind property included in the PrinterSettings.PrinterResolutions parameter of the active printer.

If the required Quality parameter is identified within the set of PrinterSettings.PrinterResolutions property items of the active printer, then the currently defined active printer resolution is filled up with the specified resolution attributes provided by the corresponding printer resolution item.

Syntax
'Declaration
 
Public Function PrintSetQuality( _
   ByVal Quality As PrintQuality _
) As GdPictureStatus
public GdPictureStatus PrintSetQuality( 
   PrintQuality Quality
)
public function PrintSetQuality( 
    Quality: PrintQuality
): GdPictureStatus; 
public function PrintSetQuality( 
   Quality : PrintQuality
) : GdPictureStatus;
public: GdPictureStatus PrintSetQuality( 
   PrintQuality Quality
) 
public:
GdPictureStatus PrintSetQuality( 
   PrintQuality Quality
) 

Parameters

Quality
A member of the PrintQuality enumeration. The new value of the active printer quality setting.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

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.

Likewise to inform you, that you can also use the PrintSetPrinterSettings method to specify all relevant printer settings for the active printer according to your preference and printer possibilities.

Example
How to set up some printer properties to be used for printing the current document.
Dim caption As String = "Example: PrintSetQuality"
Dim gdpicturePDF As GdPicturePDF = 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
        gdpicturePDF.PrintSetAlignment(PrintAlignment.PrintAlignmentMiddleCenter)
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    alignment: MiddleCenter" + vbCrLf
        Else
            message = "The PrintSetAlignment() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        gdpicturePDF.PrintSetAutoRotation(True)
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    auto-rotation: True" + vbCrLf
        Else
            message = "The PrintSetAutoRotation() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        gdpicturePDF.PrintSetCollate(True)
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    collate: True" + vbCrLf
        Else
            message = "The PrintSetCollate() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        gdpicturePDF.PrintSetColorMode(PrinterColorMode.PrinterColorModeColor)
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    color mode: Color" + vbCrLf
        Else
            message = "The PrintSetColorMode() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        gdpicturePDF.PrintSetDuplexMode(System.Drawing.Printing.Duplex.Simplex)
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    duplex: Simplex" + vbCrLf
        Else
            message = "The PrintSetDuplexMode() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        gdpicturePDF.PrintSetOrientation(PrinterOrientation.PrinterOrientationPortrait)
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    orientation: Portrait" + vbCrLf
        Else
            message = "The PrintSetOrientation() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        gdpicturePDF.PrintSetQuality(PrintQuality.PrintQualityHighResolution)
        If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
            message = message + "    quality: High" + vbCrLf
        Else
            message = "The PrintSetQuality() method has failed with the status: " + gdpicturePDF.GetStat()
        End If
    End If
    If gdpicturePDF.GetStat() = GdPictureStatus.OK Then
        If gdpicturePDF.Print() = GdPictureStatus.OK Then
            message = message + "The file has been printed successfully using new settings."
        Else
            message = message + "The file can't be printed." + vbCrLf + "Status: " + gdpicturePDF.PrintGetStat().ToString()
            If gdpicturePDF.PrintGetStat() = GdPictureStatus.PrintingException Then
                message = message + "    Error: " + gdpicturePDF.PrintGetLastError()
            End If
        End If
    Else
        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: PrintSetQuality";
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)
    {
        gdpicturePDF.PrintSetAlignment(PrintAlignment.PrintAlignmentMiddleCenter);
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    alignment: MiddleCenter\n";
        else
            message = "The PrintSetAlignment() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        gdpicturePDF.PrintSetAutoRotation(true);
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    auto-rotation: true\n";
        else
            message = "The PrintSetAutoRotation() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        gdpicturePDF.PrintSetCollate(true);
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    collate: true\n";
        else
            message = "The PrintSetCollate() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        gdpicturePDF.PrintSetColorMode(PrinterColorMode.PrinterColorModeColor);
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    color mode: Color\n";
        else
            message = "The PrintSetColorMode() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        gdpicturePDF.PrintSetDuplexMode(System.Drawing.Printing.Duplex.Simplex);
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    duplex: Simplex\n";
        else
            message = "The PrintSetDuplexMode() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        gdpicturePDF.PrintSetOrientation(PrinterOrientation.PrinterOrientationPortrait);
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    orientation: Portrait\n";
        else
            message = "The PrintSetOrientation() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        gdpicturePDF.PrintSetQuality(PrintQuality.PrintQualityHighResolution);
        if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
            message = message + "    quality: High\n";
        else
            message = "The PrintSetQuality() method has failed with the status: " + gdpicturePDF.GetStat();
    }
    if (gdpicturePDF.GetStat() == GdPictureStatus.OK)
    {
        if (gdpicturePDF.Print() == GdPictureStatus.OK)
        {
            message = message + "The file has been printed successfully using new settings.";
        }
        else
        {
            message = message + "The file can't be printed.\nStatus: " + gdpicturePDF.PrintGetStat().ToString();
            if (gdpicturePDF.PrintGetStat() == GdPictureStatus.PrintingException)
                message = message + "    Error: " + gdpicturePDF.PrintGetLastError();
        }
    }
    else
    {
        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