Q: When we print PDF documents using Qoppa’s library jPDFPrint or components (jPDFViewer, jPDFNotes or jPDFEditor), how can I adjust the print margins? I want the printed page to be exactly the same as when printing with Adobe® Reader®’s.

A: We spend a lot of time making sure that our printouts match Adobe Reader / Acrobat® printouts as closely as possible. If there is a discrepancy, the most common issue is in the print settings. When printing with Adobe, you can see the various settings to adjust the way that the content is mapped to the page in the Print Dialog.

Our PrintSettings class contains the following flags:

  • m_AutoRotate – Will rotate the printout to match the width and length with the paper. When this flag is on, the library will ignore the portrait / landscape setting set by the user. The default value is true.
  • m_ShrinkToMargins – Will shrink pages so that they fit in the paper. This flag has no effect if the pages in a document are smaller than the paper they are being printed on. The default value is true.
  • m_ExpandToMargins – Will expand pages to fill the paper they are being printed on. This flag has no effect if the pages in a document are larger than the paper they are being printed on. The default value is false.
  • m_CenterInPage – Will center the page in the paper. This flag has no effect if the pages in a document are larger than the paper they are being printed on. The default value is true.

Our default printing properties match the defaults of Adobe’s print dialog.

To change the default print settings, create an instance of PrintSettings and set the settings to the desired values.

In jPDFPrint:

PrintSettings ps = new PrintSettings();
ps.m_AutoRotate = true;
ps.m_CenterInPage = false;
ps.m_ExpandToMargins = false;
ps.m_ShrinkToMargins = false;
PDFPrint.setPrintSetting(ps);

In jPDFViewer:

PrintSettings ps = new PrintSettings();
ps.m_AutoRotate = true;
ps.m_CenterInPage = false;
ps.m_ExpandToMargins = false;
ps.m_ShrinkToMargins = false;
PDFViewerBean.setPrintSettings(ps);