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:12:16 UTC

svn commit: r1862990 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java

Author: tilman
Date: Fri Jul 12 17:12:16 2019
New Revision: 1862990

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

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=1862990&r1=1862989&r2=1862990&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 Fri Jul 12 17:12:16 2019
@@ -339,7 +339,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
@@ -351,9 +355,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)
@@ -364,11 +372,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)
@@ -380,11 +391,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
      */