Class PdfGsUtilities


  • public class PdfGsUtilities
    extends java.lang.Object
    PDF utilities based on Ghostscript.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String GS_INSTALL  
    • Constructor Summary

      Constructors 
      Constructor Description
      PdfGsUtilities()  
    • Method Summary

      Modifier and Type Method Description
      static java.io.File[] convertPdf2Png​(java.io.File inputPdfFile)
      Converts PDF to PNG format.
      static java.io.File convertPdf2Tiff​(java.io.File inputPdfFile)
      Converts PDF to TIFF format.
      static int getPdfPageCount​(java.io.File inputPdfFile)
      Gets PDF Page Count.
      static void mergePdf​(java.io.File[] inputPdfFiles, java.io.File outputPdfFile)
      Merges PDF files.
      static void splitPdf​(java.io.File inputPdfFile, java.io.File outputPdfFile, int firstPage, int lastPage)
      Splits PDF.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PdfGsUtilities

        public PdfGsUtilities()
    • Method Detail

      • convertPdf2Tiff

        public static java.io.File convertPdf2Tiff​(java.io.File inputPdfFile)
                                            throws java.io.IOException
        Converts PDF to TIFF format.
        Parameters:
        inputPdfFile - input file
        Returns:
        a multi-page TIFF image
        Throws:
        java.io.IOException
      • convertPdf2Png

        public static java.io.File[] convertPdf2Png​(java.io.File inputPdfFile)
                                             throws java.io.IOException
        Converts PDF to PNG format.
        Parameters:
        inputPdfFile - input file
        Returns:
        an array of PNG images
        Throws:
        java.io.IOException
      • splitPdf

        public static void splitPdf​(java.io.File inputPdfFile,
                                    java.io.File outputPdfFile,
                                    int firstPage,
                                    int lastPage)
        Splits PDF.
        Parameters:
        inputPdfFile - input file
        outputPdfFile - output file
        firstPage - begin page
        lastPage - end page
      • getPdfPageCount

        public static int getPdfPageCount​(java.io.File inputPdfFile)
        Gets PDF Page Count.
        Parameters:
        inputPdfFile - input file
        Returns:
        number of pages
      • mergePdf

        public static void mergePdf​(java.io.File[] inputPdfFiles,
                                    java.io.File outputPdfFile)
        Merges PDF files.
        Parameters:
        inputPdfFiles - array of input files
        outputPdfFile - output file