Changing Papersize for printing doesn't work

I am trying to print a PDF file in another Paper Size than A4. Looked like a simple job to do, but i’m not able to get it working.

Tried on Version 9.5 and 10.1, but both with the same result.

Here’s the code i use (although it is not very much).

pdftron.PDF.PDFDoc doc = new pdftron.PDF.PDFDoc(document);

pdftron.PDF.PrinterMode mode = new pdftron.PDF.PrinterMode();
pdftron.PDF.Print.StartPrintJob(doc, "PDF24 PDF", doc.GetFileName(), "", null, mode, null);

The mode.SetPaperSize-Function seems to be ignored. The printed Document has always the Dimensions af an A4 Page.

However other Functions such as mode.SetCopyCount work as expected. Am i something missing here?



The papersize setting ties more directly into the target output.

For physical printers, that actual page size of course depends on the paper physically loaded into the target tray.

For virtual printers, some may ignore the setting and always generate to their own page size.

What exact printer are you printing to?

I tried “PDF24 PDF” and “PDFCreator” (both are virtual Printers). I tried the same with Word (Change Layout to A3 and then Print with PDF24) and it worked. So i assumed, that it should work in general.

But i’ll give it a try tomorrow with a real printer. If this works, it should be OK for us in most of the cases.

@Ryan I did futher investigate with a real printer and tried several virtual printers, but unfortunately the result is disappointing.

Printing on a real printer, that can print in A3 the PDF is printed in A4. Printing with “Microsoft Print to PDF” on the other hand, the PDF is printed correct in A4 or A3.

Also printing with the PDFViewCtrl::Print Method and set the Papersize via the printer settings doesn’t have an effect, the result is again A4. Printing the same PDF for example in Adobe Acrobat and setting the Papersize via the same settings dialog it works as expected.

Is there a way to track this issue down somehow?

Printing on a real printer, that can print in A3 the PDF is printed in A4.

What do you mean exactly here? The physical printer has two trays, one tray holding A3 paper, and the other tray holding A4 paper? And you expected printing to occur using the A3 tray, but instead the tray holding the A4 paper was used?

What would you expect to happen if Letter paper size (or any of the other many paper size enums) was selected via PrinterMode API?

Exactly, the printer has an A3 and A4 tray. The A4 tray is always used, regardless if i print with Print::StartPrintJob and use SetPapersize with A3 or if i use the printer settings directly (see screenshot below).

Doing the same in Adobe Acrobat or a similiar PDF-Viewer it works as expected and the A3 tray is used:

The same is happening when printing to a virtual printer like PDF24 PDF. Adobe produces a PDF with the size of 297x420 wheras PDFTron/Apryse-SDK is producing 210x297.

On a real printer: In our case the printer software is handling this. For example printing a Letter paper size shows on the printer screen that this format is not available and you have to choose another format.

On a virtual printer: I would expect, that a PDF with the dimensions of the chosen format is produced and scaling of the option “Scale type” is applied.

Ok, so it seems you are reporting two issues. One about printer paper tray, and another about some virtual printers not outputing the expected page dimensions.

PDFNet does not support Tray selection, that would require you to configure the printer yourself. See this forum post (last paragraph) to learn more.

The same is happening when printing to a virtual printer like PDF24 PDF

PDFNet is generating PDF pages as exactly specified, and other printers, like Microsoft Print to PDF output a PDF with the your selected page size, so if PDF24 PDF is not that would be an issue with that virtual printer. Perhaps a similar solution to the tray issue would also resolve it.