Class PDFRenderer


  • public class PDFRenderer
    extends Object
    Renders a PDF document to an AWT BufferedImage. This class may be overridden in order to perform custom rendering.
    • Field Detail

    • Constructor Detail

      • PDFRenderer

        public PDFRenderer​(PDDocument document)
        Creates a new PDFRenderer.
        Parameters:
        document - the document to render
    • Method Detail

      • renderImage

        public android.graphics.Bitmap renderImage​(int pageIndex)
                                            throws IOException
        Returns the given page as an RGB image at 72 DPI
        Parameters:
        pageIndex - the zero-based index of the page to be converted.
        Returns:
        the rendered page image
        Throws:
        IOException - if the PDF cannot be read
      • renderImageWithDPI

        public android.graphics.Bitmap renderImageWithDPI​(int pageIndex,
                                                          float dpi)
                                                   throws IOException
        Returns the given page as an RGB image at the given DPI.
        Parameters:
        pageIndex - the zero-based index of the page to be converted
        dpi - the DPI (dots per inch) to render at
        Returns:
        the rendered page image
        Throws:
        IOException - if the PDF cannot be read
      • renderImageWithDPI

        public android.graphics.Bitmap renderImageWithDPI​(int pageIndex,
                                                          float dpi,
                                                          android.graphics.Bitmap.Config imageType)
                                                   throws IOException
        Returns the given page as an RGB image at the given DPI.
        Parameters:
        pageIndex - the zero-based index of the page to be converted
        dpi - the DPI (dots per inch) to render at
        imageType - the type of image to return
        Returns:
        the rendered page image
        Throws:
        IOException - if the PDF cannot be read
      • renderImage

        public android.graphics.Bitmap renderImage​(int pageIndex,
                                                   float scale,
                                                   android.graphics.Bitmap.Config config)
                                            throws IOException
        Returns the given page as an RGB image at the given scale.
        Parameters:
        pageIndex - the zero-based index of the page to be converted
        scale - the scaling factor, where 1 = 72 DPI
        config - the bitmap config to create
        Returns:
        the rendered page image
        Throws:
        IOException - if the PDF cannot be read
      • renderPage

        public void renderPage​(PDPage page,
                               android.graphics.Paint paint,
                               android.graphics.Canvas canvas,
                               int width,
                               int height,
                               float scaleX,
                               float scaleY)
                        throws IOException
        Throws:
        IOException