Package net.sourceforge.tess4j.util
Class PdfUtilities
- java.lang.Object
-
- net.sourceforge.tess4j.util.PdfUtilities
-
public class PdfUtilities extends java.lang.Object
PDF utilities based on Ghostscript or PDFBox with Ghostscript as default. If Ghostscript is not available on the system, then PDFBox is used. CallSystem.setProperty(PDF_LIBRARY, PDFBOX);
to set PDFBox as default.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PDF_LIBRARY
static java.lang.String
PDFBOX
-
Constructor Summary
Constructors Constructor Description PdfUtilities()
-
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 int
getPdfPageCount(java.lang.String inputPdfFile)
Deprecated.As of Release 3.0.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.static void
splitPdf(java.lang.String inputPdfFile, java.lang.String outputPdfFile, java.lang.String firstPage, java.lang.String lastPage)
Deprecated.As of Release 3.0.
-
-
-
Field Detail
-
PDF_LIBRARY
public static final java.lang.String PDF_LIBRARY
- See Also:
- Constant Field Values
-
PDFBOX
public static final java.lang.String PDFBOX
- See Also:
- Constant Field Values
-
-
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.lang.String inputPdfFile, java.lang.String outputPdfFile, java.lang.String firstPage, java.lang.String lastPage)
Deprecated.As of Release 3.0.Splits PDF.- Parameters:
inputPdfFile
- input fileoutputPdfFile
- output filefirstPage
- begin pagelastPage
- end page
-
splitPdf
public static void splitPdf(java.io.File inputPdfFile, java.io.File outputPdfFile, int firstPage, int lastPage)
Splits PDF.- Parameters:
inputPdfFile
- input fileoutputPdfFile
- output filefirstPage
- begin pagelastPage
- end page
-
getPdfPageCount
public static int getPdfPageCount(java.lang.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(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 filesoutputPdfFile
- output file
-
-