Skip to main content

Page Scaling

Version: 3.0

Page Scaling

Below are some examples for printing a PDF with different page scaling options. Page scaling can be done by specifying a scaling factor with respect to the dimensions of the PDF page or it can be scaled with respect to the printable area or edges of the page.

Percentage Page Scaling​

The example below demonstrates how to scale the PDF page by a certain scaling factor. For example, a scaling factor of 0.5 scales the page dimensions by 50%.

PrintJob printJob = new PrintJob(Printer.Default, pdfFilePath);
PercentagePageScaling percentagePageScaling = new PercentagePageScaling(0.5f);
printJob.PrintOptions.Scaling = percentagePageScaling;
printJob.Print();
Dim MyPrintJob As PrintJob = New PrintJob(Printer.Default, pdfFilePath)
Dim MyPercentagePageScaling As PercentagePageScaling = New PercentagePageScaling(0.5F)
MyPrintJob.PrintOptions.Scaling = MyPercentagePageScaling
MyPrintJob.Print()

Printable Area or Page Edge Scaling​

The example below demonstrates how to scale the print job with respect to the page printable area. Use ScaleTo.PageEdges to scale the print job with respect to page edges.

PrintJob printJob = new PrintJob(Printer.Default, pdfFilePath);
AutoPageScaling autoPageScaling = new AutoPageScaling(ScaleTo.PagePrintableArea, true, true);
printJob.PrintOptions.Scaling = autoPageScaling;
printJob.Print();
Dim MyPrintJob As PrintJob = New PrintJob(Printer.Default, pdfFilePath)
Dim MyAutoPageScaling As AutoPageScaling = New AutoPageScaling(ScaleTo.PagePrintableArea, True, True)
MyPrintJob.PrintOptions.Scaling = MyAutoPageScaling
MyPrintJob.Print()