[ 
https://issues.apache.org/jira/browse/PDFBOX-2922?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14680905#comment-14680905
 ] 

John Hewson edited comment on PDFBOX-2922 at 8/10/15 11:06 PM:
---------------------------------------------------------------

The behaviour which you were encountering was a bug. The orientation code for 
PDFPageable was working fine for portrait pages, or rotated portrait pages but 
it didn't work for landscape pages, i.e. pages where the MediaBox width > 
height. Java doesn't seem to like landscape paper and unhelpfully "corrects" 
the imageable area which PDFPageable provided by cropping it down to portrait 
size, even though the paper is sized as landscape. This happens regardless of 
whether the PageFormat's orientation is portrait or landscape, so I suspect it 
is a JDK bug.

I've come up with a workaround where we normalise the paper size to be 
portrait, then set the PageFormat's orientation flag to represent the original 
orientation. This produces the expected results.

You should now be able to simply print this file using Orientation.AUTO and 
everything should work.


was (Author: jahewson):
The behaviour which you were encountering was a bug. The orientation code for 
PDFPageable was working fine for portrait pages, or rotated portrait pages but 
it didn't work for landscape pages, i.e. pages where the MediaBox width > 
height. Java doesn't seem to like landscape paper and unhelpfully "corrects" 
the imageable area which PDFPageable provided by cropping it down to portrait 
size, even though the paper is sized as landscape. This happens regardless of 
whether the PageFormat's orientation is portrait or landscape, so I suspect it 
is a JDK bug.

I've come up with a workaround where we normalise the paper size to be 
portrait, then set the PageFormat's orientation flag to represent the original 
orientation. This produces the expected results.

> Printing issues with landscape pages
> ------------------------------------
>
>                 Key: PDFBOX-2922
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2922
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Rendering
>    Affects Versions: 2.0.0
>            Reporter: Pei-Tang Huang
>            Assignee: John Hewson
>         Attachments: landscape.pdf, rotated_cropping_failed.jpg, success.jpg
>
>
> Would you please remove the {{final}} modifier from {{PDFPrintable}} and 
> {{PDFPageable}} so that one can extending those classes.
> UPDATE: I've modified the original title of this issue to reflect the 
> underlying bug, rather than the user wanting to have "final" removed for 
> these classes and fix the bug themselves.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to