You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2017/01/27 16:44:43 UTC
svn commit: r1780584 -
/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Author: tilman
Date: Fri Jan 27 16:44:43 2017
New Revision: 1780584
URL: http://svn.apache.org/viewvc?rev=1780584&view=rev
Log:
PDFBOX-3000: simplify calculations
Modified:
pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1780584&r1=1780583&r2=1780584&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Fri Jan 27 16:44:43 2017
@@ -1342,8 +1342,6 @@ public class PageDrawer extends PDFGraph
// here is draw it directly onto the Graphics2D device at the appropriate position
PDRectangle bbox = group.getBBox();
AffineTransform prev = graphics.getTransform();
- float x = bbox.getLowerLeftX();
- float y = pageSize.getHeight() - bbox.getLowerLeftY() - bbox.getHeight();
Matrix m = new Matrix(xform);
float xScale = Math.abs(m.getScalingFactorX());
@@ -1354,8 +1352,10 @@ public class PageDrawer extends PDFGraph
graphics.rotate(Math.toRadians(pageRotation));
- // adjust (x,y) at the initial scale + cropbox
- graphics.translate((x - pageSize.getLowerLeftX()) * xScale, (y + pageSize.getLowerLeftY()) * yScale);
+ // adjust bbox (x,y) position at the initial scale + cropbox
+ float x = bbox.getLowerLeftX() - pageSize.getLowerLeftX();
+ float y = pageSize.getUpperRightY() - bbox.getUpperRightY();
+ graphics.translate(x * xScale, y * yScale);
if (flipTG)
{