pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1841250 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
Date Tue, 18 Sep 2018 19:22:44 GMT
Author: tilman
Date: Tue Sep 18 19:22:44 2018
New Revision: 1841250

URL: http://svn.apache.org/viewvc?rev=1841250&view=rev
Log:
PDFBOX-4306: avoid single blank pixel line on the right or on the bottom, as suggested by
Daniel Persson

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

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java?rev=1841250&r1=1841249&r2=1841250&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
Tue Sep 18 19:22:44 2018
@@ -195,8 +195,11 @@ public class PDFRenderer
         PDRectangle cropbBox = page.getCropBox();
         float widthPt = cropbBox.getWidth();
         float heightPt = cropbBox.getHeight();
-        int widthPx = Math.round(widthPt * scale);
-        int heightPx = Math.round(heightPt * scale);
+
+        // PDFBOX-4306 avoid single blank pixel line on the right or on the bottom
+        int widthPx = (int) Math.max(Math.floor(widthPt * scale), 1);
+        int heightPx = (int) Math.max(Math.floor(heightPt * scale), 1);
+
         int rotationAngle = page.getRotation();
 
         int bimType = imageType.toBufferedImageType();



Mime
View raw message