Changes to PDF printing

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 (TwitterFacebook and Google+) or the  Blog RSS.

Related Posts:

The following two tabs change content below.
Kieran France is a programmer for IDRSolutions. He enjoys tinkering with most things including gadgets, code and electronics. He often has no idea what to write in his blog posts but tries his hardest to make them interesting and entertaining, he also makes no excuses for his odd sense of humor.
KieranF

About Kieran France

Kieran France is a programmer for IDRSolutions. He enjoys tinkering with most things including gadgets, code and electronics. He often has no idea what to write in his blog posts but tries his hardest to make them interesting and entertaining, he also makes no excuses for his odd sense of humor.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>