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 2019/07/12 17:18:59 UTC

svn commit: r1862991 - /pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java

Author: tilman
Date: Fri Jul 12 17:18:58 2019
New Revision: 1862991

URL: http://svn.apache.org/viewvc?rev=1862991&view=rev
Log:
PDFBOX-4581, PDFBOX-4583: improve javadoc

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

Modified: pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java?rev=1862991&r1=1862990&r2=1862991&view=diff
==============================================================================
--- pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java (original)
+++ pdfbox/branches/issue45/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java Fri Jul 12 17:18:58 2019
@@ -332,7 +332,11 @@ public class PDFRenderer
     }
 
     /**
-     * Renders a given page to an AWT Graphics2D instance.
+     * Renders a given page to an AWT Graphics2D instance at 72 DPI.
+     * <p>
+     * Read {@link #renderPageToGraphics(int, java.awt.Graphics2D, float, float, org.apache.pdfbox.rendering.RenderDestination) renderPageToGraphics(int, Graphics2D, float, float, RenderDestination)}
+     * before using this.
+     *
      * @param pageIndex the zero-based index of the page to be converted
      * @param graphics the Graphics2D on which to draw the page
      * @throws IOException if the PDF cannot be read
@@ -344,9 +348,13 @@ public class PDFRenderer
 
     /**
      * Renders a given page to an AWT Graphics2D instance.
+     * <p>
+     * Read {@link #renderPageToGraphics(int, java.awt.Graphics2D, float, float, org.apache.pdfbox.rendering.RenderDestination) renderPageToGraphics(int, Graphics2D, float, float, RenderDestination)}
+     * before using this.
+     *
      * @param pageIndex the zero-based index of the page to be converted
      * @param graphics the Graphics2D on which to draw the page
-     * @param scale the scale to draw the page at
+     * @param scale the scaling factor, where 1 = 72 DPI
      * @throws IOException if the PDF cannot be read
      */
     public void renderPageToGraphics(int pageIndex, Graphics2D graphics, float scale)
@@ -357,11 +365,14 @@ public class PDFRenderer
 
     /**
      * Renders a given page to an AWT Graphics2D instance.
+     * <p>
+     * Read {@link #renderPageToGraphics(int, java.awt.Graphics2D, float, float, org.apache.pdfbox.rendering.RenderDestination) renderPageToGraphics(int, Graphics2D, float, float, RenderDestination)}
+     * before using this.
      * 
      * @param pageIndex the zero-based index of the page to be converted
      * @param graphics the Graphics2D on which to draw the page
-     * @param scaleX the scale to draw the page at for the x-axis
-     * @param scaleY the scale to draw the page at for the y-axis
+     * @param scaleX the scale to draw the page at for the x-axis, where 1 = 72 DPI
+     * @param scaleY the scale to draw the page at for the y-axis, where 1 = 72 DPI
      * @throws IOException if the PDF cannot be read
      */
     public void renderPageToGraphics(int pageIndex, Graphics2D graphics, float scaleX, float scaleY)
@@ -373,11 +384,23 @@ public class PDFRenderer
 
     /**
      * Renders a given page to an AWT Graphics2D instance.
+     * <p>
+     * Known problems:
+     * <ul>
+     * <li>rendering of PDF files with transparencies is not supported on Ubuntu, see
+     * <a href="https://issues.apache.org/jira/browse/PDFBOX-4581">PDFBOX-4581</a> and
+     * <a href="https://bugs.openjdk.java.net/browse/JDK-6689349">JDK-6689349</a>. Rendering will
+     * not abort, but the pages will be rendered incorrectly.</li>
+     * <li>Clipping the Graphics2D will not work properly, see
+     * <a href="https://issues.apache.org/jira/browse/PDFBOX-4583">PDFBOX-4583</a></li>.
+     * </ul>
+     * If you encounter these problems, then you should render into an image by using the
+     * {@link #renderImage(int) renderImage} methods.
      * 
      * @param pageIndex the zero-based index of the page to be converted
      * @param graphics the Graphics2D on which to draw the page
-     * @param scaleX the scale to draw the page at for the x-axis
-     * @param scaleY the scale to draw the page at for the y-axis
+     * @param scaleX the scale to draw the page at for the x-axis, where 1 = 72 DPI
+     * @param scaleY the scale to draw the page at for the y-axis, where 1 = 72 DPI
      * @param destination controlling visibility of optional content groups
      * @throws IOException if the PDF cannot be read
      */