Kieran France is a programmer for IDRSolutions. He enjoys tinkering with most things including gadgets, code and electronics. He spends his time working on the the JPedal library and our internal test suite..

Changes to PDF printing

June 5, 2013 1 min read

Recently we have had a request to allow auto rotation of printed pdf pages without centering them within the print pages imageable area. This was an easy enough task to achieve but has made some changes I thought it wise to write about so as to give a little more detail.

The first and most important change to mention is the removal of a public variable. The variable isAutoRotateAndCenter within SwingPrinter has been completely removed. This variable was a flag that allowed the page to be both rotated and centered, as we are split this functionality we now need two flags, one for each.

In place of isAutoRotateAndCenter we now have two flags which can be controlled using SwingPrinter.setAutoRotate(boolean) and SwingPrinter.setCenterOnScaling(boolean).

On top of this I have also added a new method to the PdfDecoder so we have a complete set of methods in this class to alter the rotation and centering of the printer page.

PdfDecoder.setPrintAutoRotate(boolean) sets a flag to control if the page should auto rotate to best fit the printed page imageable area.

PdfDecoder.setCenterOnScaling(boolean) sets a flag to control if center the page within the printed page imageable area.

PdfDecoder.setPrintAutoRotateAndCenter(boolean) sets the flags to control if the page should auto rotate to best fit the printed page imageable area and center it within the imageable area.

That’s it, there aren’t many changes in this one but as it has resulted in the removal of a public variable we thought it would be best to post something.

This post is part of our “Printing Articles Index” in these articles, we aim to help you understand printing in Java and PDF’s.

If you’re a first-time reader, or simply want to be notified when we post new articles and updates, you can keep up to date by social media (Twitter, Facebook and Google+) or the Blog RSS.

Kieran France is a programmer for IDRSolutions. He enjoys tinkering with most things including gadgets, code and electronics. He spends his time working on the the JPedal library and our internal test suite..