Class PdfboxConvertor

    • Method Detail

      • writeImages

        protected List<StringwriteImages​(PDDocument document,
                                           File folder,
                                           String imageFormat,
                                           String outputPrefix)
                                    throws IOException,
                                           FlipbookException
        Converts a given page range of a PDF document to bitmap images.
        Parameters:
        document - the PDF document
        folder - the folder where to write
        imageFormat - the target format (ex. "png")
        outputPrefix - used to construct the filename for the individual images
        Returns:
        true if the images were produced, false if there was an error
        Throws:
        IOException - if an I/O error occurs
        FlipbookException - if an error occurs when manipulating the flipbook
      • writeImages

        protected List<StringwriteImages​(PDDocument document,
                                           File folder,
                                           String imageFormat,
                                           String outputPrefix,
                                           int resolution)
                                    throws IOException,
                                           FlipbookException
        Converts a given page range of a PDF document to bitmap images.
        Parameters:
        document - the PDF document
        folder - the folder where to write
        imageFormat - the target format (ex. "png")
        outputPrefix - used to construct the filename for the individual images
        resolution - the resolution in dpi (dots per inch)
        Returns:
        true if the images were produced, false if there was an error
        Throws:
        IOException - if an I/O error occurs
        FlipbookException - if an error occurs when manipulating the flipbook
      • writeImages

        protected List<StringwriteImages​(PDDocument document,
                                           File folder,
                                           String imageFormat,
                                           String password,
                                           int startPage,
                                           int endPage,
                                           String outputPrefix,
                                           org.apache.pdfbox.rendering.ImageType imageType,
                                           int resolution,
                                           float quality)
                                    throws IOException,
                                           FlipbookException
        Converts a given page range of a PDF document to bitmap images.
        Parameters:
        document - the PDF document
        folder - the folder where to write
        imageFormat - the target format (ex. "png")
        password - the password (needed if the PDF is encrypted)
        startPage - the start page (1 is the first page)
        endPage - the end page (set to Integer.MAX_VALUE for all pages)
        outputPrefix - used to construct the filename for the individual images
        imageType - the image type (see BufferedImage.TYPE_*)
        resolution - the resolution in dpi (dots per inch)
        quality - the image compression quality (0 < quality < 1.0f).
        Returns:
        true if the images were produced, false if there was an error
        Throws:
        IOException - if an I/O error occurs
        FlipbookException - if an error occurs when manipulating the flipbook
      • writePreview

        protected void writePreview​(File folder,
                                    String outputPrefix)
                             throws IOException
        Generate the preview image
        Parameters:
        folder - The folder with the PDF images
        outputPrefix - The prefix of PDF images
        Throws:
        IOException - if an I/O error occurs