pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1644537 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
Date Wed, 10 Dec 2014 23:28:37 GMT
Author: tilman
Date: Wed Dec 10 23:28:36 2014
New Revision: 1644537

URL: http://svn.apache.org/r1644537
Log:
PDFBOX-2552: normalize the rotation angle for all values

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java?rev=1644537&r1=1644536&r2=1644537&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java Wed Dec
10 23:28:36 2014
@@ -117,11 +117,11 @@ public class PDFRenderer
         int rotationAngle = page.getRotation();
 
         // normalize the rotation angle
-        if (rotationAngle < 0)
+        while (rotationAngle < 0)
         {
             rotationAngle += 360;
         }
-        else if (rotationAngle >= 360)
+        while (rotationAngle >= 360)
         {
             rotationAngle -= 360;
         }
@@ -188,6 +188,17 @@ public class PDFRenderer
 
         PDRectangle cropBox = page.getCropBox();
         int rotationAngle = page.getRotation();
+        
+        // normalize the rotation angle
+        while (rotationAngle < 0)
+        {
+            rotationAngle += 360;
+        }
+        while (rotationAngle >= 360)
+        {
+            rotationAngle -= 360;
+        }
+        
         if (rotationAngle != 0)
         {
             float translateX = 0;



Mime
View raw message