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

Tilman Hausherr edited comment on PDFBOX-2021 at 4/12/14 5:50 AM:
------------------------------------------------------------------

My diff tests show that the files that come out right are shifted by maybe 1 
pixel. I wouldn't count this as a bug, one could as well argue that the 
previous rendering was wrong :-)

I took some time to look at the old and the new code. The old code does 
translate, rotate, scale. The new code does scale, translate, rotate. The 
translation values are different in the new code but they are adjusted to the 
scale factor so that is OK. However the translations are on the wrong axis. The 
old code is weird (my understanding is that two translations would be needed, 
see [here|http://mindprod.com/jgloss/affinetransform.html#ROTATING]), 90 and 
270 rotations are translated on different axes, but it works (I suspect that 
there is more done elsewhere in the code). Thus, the new code must also be 
weird :-) I have test files for 90 and for 270, and both render correctly after 
the change. I created a test file for 180 and it rendered correctly without a 
change.


was (Author: tilman):
My diff tests show that the files that come out right are shifted by maybe 1 
pixel. I wouldn't count this as a bug, one could as well argue that the 
previous rendering was wrong :-)

I took some time to look at the old and the new code. The old code does 
translate, rotate, scale. The new code does scale, translate, rotate. The 
translation values are different in the new code but they are adjusted so that 
is OK. However the translations are on the wrong axis. The old code is weird 
(my understanding is that two translations would be needed, see 
[here|http://mindprod.com/jgloss/affinetransform.html#ROTATING]), 90 and 270 
rotations are translated on different axes, but it works (I suspect that there 
is more done elsewhere in the code). Thus, the new code must also be weird :-) 
I have test files for 90 and for 270, and both render correctly after the 
change. I created a test file for 180 and it rendered correctly without a 
change.

> PDFPrinter problem with landscape and rotated pages 
> ----------------------------------------------------
>
>                 Key: PDFBOX-2021
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2021
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.0
>            Reporter: John Hewson
>            Assignee: John Hewson
>             Fix For: 2.0.0
>
>         Attachments: usps.pdf
>
>
> PDFPrinter does not correctly print landscape or rotated pages, there is code 
> which attempts to do both these things, however the results is wrong. There 
> are three main issues:
> - the centering code does*not* center the image correctly because it assumes 
> that imageableArea is the Graphics2D origin, but it is actually the page 
> margin size and the Graphics2D origin remains the physical top-left edge of 
> the paper.
> - auto portrait/landcape is actually sets the imageableArea, so it is 
> actually setting the page margins, instead of the Graphics2D origin. This is 
> actually overwriting the user's desired margins as well as placing the image 
> incorrectly on the page.
> - the Page dictionary "Rotate" key is not taken into account, so rotated 
> pages appear incorrectly.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to