You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2019/01/30 16:25:00 UTC

[jira] [Commented] (PDFBOX-4449) Rotated pages produce matrix value like -0.999999999999999 instead of -1

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

ASF subversion and git services commented on PDFBOX-4449:
---------------------------------------------------------

Commit 1852534 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1852534 ]

PDFBOX-4449: remove uneeded cast; apply Math.abs() to scale values

> Rotated pages produce matrix value like -0.999999999999999 instead of -1
> ------------------------------------------------------------------------
>
>                 Key: PDFBOX-4449
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4449
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.13
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>            Priority: Minor
>             Fix For: 2.0.14, 3.0.0 PDFBox
>
>
> I was wondering why I got AffineTransform objects like 
> {code}
> AffineTransform[[-4.371139E-8, 0.999999999999999, 7.96E-13], [0.999999999999999, 4.371139E-8, -3.4619420881E-5]]
> {code}
> which makes debugging difficult, instead of
> {code}
> AffineTransform[[0.0, 1.0, -0.0], [1.0, 0.0, -0.0]]
> {code}
> The cause is this code line in PDFRenderer:
> {code}
> graphics.rotate((float) Math.toRadians(rotationAngle));
> {code}
> Solution: removing the cast produces a nice AffineTransform object:
> {code}
> graphics.rotate(Math.toRadians(rotationAngle));
> {code}
> However... this resulted in rendering bugs in several files (gs-bugzilla690022-reduced-rotations.pdf, gs-bugzilla690022-reduced-rotations-cropbox.pdf, PDFJS-5811-2-p4_reduced-rotations.pdf). Researching this found that {{getScalingFactorX()}} and {{getScalingFactorY()}} return negative values which they didn't before. Using {{Math.abs()}} solves this problem and now two files are slightly better (lines no longer very slightly diagonal): PDFBOX-2376-466070.pdf page 24 and PDFBOX-4399-046615_p9_OCG-NoRotate-Annotations.pdf .



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org