Class PdfUtilities

java.lang.Object
net.sourceforge.tess4j.util.PdfUtilities

public class PdfUtilities extends Object
PDF utilities based on Ghostscript or PDFBox with Ghostscript as default. If Ghostscript is not available on the system, then PDFBox is used. Call System.setProperty(PDF_LIBRARY, PDFBOX); to set PDFBox as default.
  • Field Details

  • Constructor Details

    • PdfUtilities

      public PdfUtilities()
  • Method Details

    • convertPdf2Tiff

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

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

      public static void splitPdf(String inputPdfFile, String outputPdfFile, String firstPage, String lastPage)
      Deprecated.
      As of Release 3.0.
      Splits PDF.
      Parameters:
      inputPdfFile - input file
      outputPdfFile - output file
      firstPage - begin page
      lastPage - end page
    • splitPdf

      public static void splitPdf(File inputPdfFile, 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(String inputPdfFile)
      Deprecated.
      As of Release 3.0.
      Gets PDF Page Count.
      Parameters:
      inputPdfFile - input file
      Returns:
      number of pages
    • getPdfPageCount

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

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