public class PdfboxConvertor extends AbstractLogEnabled implements Document2ImagesConvertor
PDFImageWriter utility class, adding the possibility to specify the file name pattern.ROLE| Constructor and Description |
|---|
PdfboxConvertor() |
| Modifier and Type | Method and Description |
|---|---|
private static BufferedImage |
_resizeImage(BufferedImage src,
int maxHeight,
int maxWidth) |
void |
convert(File pdfFile,
File folder)
Convert the given document file to PNG images, one image per page.
|
List<String> |
getSupportedMimeTypes()
Get the list of mime types the convertor can convert
|
protected List<String> |
writeImages(PDDocument document,
File folder,
String imageFormat,
String outputPrefix)
Converts a given page range of a PDF document to bitmap images.
|
protected List<String> |
writeImages(PDDocument document,
File folder,
String imageFormat,
String outputPrefix,
int resolution)
Converts a given page range of a PDF document to bitmap images.
|
protected List<String> |
writeImages(PDDocument document,
File folder,
String imageFormat,
String password,
int startPage,
int endPage,
String outputPrefix,
int imageType,
int resolution,
float quality)
Converts a given page range of a PDF document to bitmap images.
|
protected void |
writePreview(File folder,
String outputPrefix)
Generate the preview image
|
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerpublic PdfboxConvertor()
public void convert(File pdfFile, File folder) throws IOException, FlipbookException
Document2ImagesConvertorconvert in interface Document2ImagesConvertorpdfFile - the document file to convert.folder - the destination folder.IOException - if an I/O error occurs.FlipbookException - if a document error occurs.protected List<String> writeImages(PDDocument document, File folder, String imageFormat, String outputPrefix) throws IOException, FlipbookException
document - the PDF documentfolder - the folder where to writeimageFormat - the target format (ex. "png")outputPrefix - used to construct the filename for the individual imagesIOException - if an I/O error occursFlipbookException - if an error occurs when manipulating the flipbookprotected List<String> writeImages(PDDocument document, File folder, String imageFormat, String outputPrefix, int resolution) throws IOException, FlipbookException
document - the PDF documentfolder - the folder where to writeimageFormat - the target format (ex. "png")outputPrefix - used to construct the filename for the individual imagesresolution - the resolution in dpi (dots per inch)IOException - if an I/O error occursFlipbookException - if an error occurs when manipulating the flipbookprotected List<String> writeImages(PDDocument document, File folder, String imageFormat, String password, int startPage, int endPage, String outputPrefix, int imageType, int resolution, float quality) throws IOException, FlipbookException
document - the PDF documentfolder - the folder where to writeimageFormat - 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 imagesimageType - the image type (see BufferedImage.TYPE_*)resolution - the resolution in dpi (dots per inch)quality - the image compression quality (0 < quality < 1.0f).IOException - if an I/O error occursFlipbookException - if an error occurs when manipulating the flipbookpublic List<String> getSupportedMimeTypes()
Document2ImagesConvertorgetSupportedMimeTypes in interface Document2ImagesConvertorprotected void writePreview(File folder, String outputPrefix) throws IOException
folder - The folder with the PDF imagesoutputPrefix - The prefix of PDF imagesIOException - if an I/O error occursprivate static BufferedImage _resizeImage(BufferedImage src, int maxHeight, int maxWidth)