Skip to main content

Print Options

Version: 3.0

Print Options

Below are some examples for printing a PDF with different print options. Print options can be set for the entire print job or for each page within the print job.

The below example demonstrates how to send a particular PDF document to the printer while setting the document to print 2 copies, in color, actual size scaling and without annotations.

Note here that in order to set a certain option on a particular PrintJob you use the PrintOption's properties (i.e. printJob.PrintOptions.Color). If however you wanted to check if a particular printer supported a certain feature, this can be checked using the Printer's properties (i.e. printJob.Printer.Color).

Setting options on a print job (in the PrintOptions class) that are not supported by the specified printer will throw an exception. For example if you set your PrintJob.PrintOptions.Color to true but the specified printer does not support color, an exception will be thrown.

PrintJob printJob = new PrintJob(Printer.Default, pdfFilePath);

if (printJob.Printer.Color)
printJob.PrintOptions.Color = true;

printJob.PrintOptions.Copies = 2;
printJob.PrintOptions.Scaling = PageScaling.ActualSize; // Can also use AutoPageScaling or PercentagePageScaling objects
printJob.PrintOptions.PrintAnnotations = false;

printJob.Print();
Dim MyPrintJob As New PrintJob(Printer.Default, pdfFilePath)

If (MyPrintJob.Printer.Color) Then
MyPrintJob.PrintOptions.Color = True
End If

MyPrintJob.PrintOptions.Copies = 2
MyPrintJob.PrintOptions.Scaling = PageScaling.ActualSize ' Can also use AutoPageScaling or PercentagePageScaling objects
MyPrintJob.PrintOptions.PrintAnnotations = False

MyPrintJob.Print()

Page Level Print Options​

The example below demonstrates how to override the global print options for a specific page within the print job using PrintJobPagePrintOptions class.

PrintJobPagePrintOptions.Inherit property has to be set to false before updating the print options for that page. Not all print options available at the global level are available at the page level.

Properties like Color, Copies, Collate, DuplexMode & Resolution are not available at the page level, they can only be set for the entire print job.

PrintJob printJob = new PrintJob(Printer.Default, pdfFilePath);
//Set the print options for the entire print job.
if (printJob.Printer.Color)
printJob.PrintOptions.Color = true;

printJob.PrintOptions.Copies = 2;
printJob.PrintOptions.Scaling = PageScaling.ActualSize;
printJob.PrintOptions.PrintAnnotations = false;

//Get the last page and set its print options.
PrintJobPage printJobPage = printJob.Pages[printJob.Pages.Count - 1];
PrintJobPagePrintOptions pagePrintOptions = printJobPage.PrintOptions;

//Set Inherit property to false in order to change the print options for a specific page.
pagePrintOptions.Inherit = false;
pagePrintOptions.Scaling = new PercentagePageScaling(0.5f);
pagePrintOptions.HorizontalAlign = HorizontalAlign.Left;
pagePrintOptions.PrintAnnotations = true;
printJob.Print();
Dim printJob As New PrintJob(Printer.Default, pdfFilePath)
'Set the print options for the entire print job.
If (printJob.Printer.Color) Then
printJob.PrintOptions.Color = True
End If

printJob.PrintOptions.Copies = 2
printJob.PrintOptions.Scaling = PageScaling.ActualSize
printJob.PrintOptions.PrintAnnotations = False

'Get the last page and set its print options.
Dim printJobPage As PrintJobPage = printJob.Pages(printJob.Pages.Count - 1)
Dim pagePrintOptions As PrintJobPagePrintOptions = printJobPage.PrintOptions

'Set Inherit property to false in order to change the print options for a specific page.
pagePrintOptions.Inherit = False
pagePrintOptions.Scaling = New PercentagePageScaling(0.5F)
pagePrintOptions.HorizontalAlign = HorizontalAlign.Left
pagePrintOptions.PrintAnnotations = True
printJob.Print()