Description
We are trying to convert PDF to Tiff using the below code, the tiff images are not coming well (width is shrinking, please see the attachment of pdf file and converted tiff file).
PDDocument document = PDDocument.load(pdfFile);
List<PDPage> pages = document.getDocumentCatalog().getAllPages();
for (int i = 0; i < pages.size(); i++) {
PDPage page = (PDPage) pages.get;
BufferedImage image = page.convertToImage(12, 300);
// Convert this image to tiff file.
}
To overcome this problem I modified below code in 'org.apache.pdfbox.util.operator.pagedrawer.Invoke' to adjust the width and height.
// My page width is always 2479
int imageWidth = awtImage.getWidth();
if(imageWidth > 2479) {
imageWidth = 2479;
}
// My page height is always 3508
int imageHeight = awtImage.getHeight();
if(imageHeight > 3508) {
imageHeight = 3508;
}
Now images are coming fine, it is very slow in processing, not even processing 25 pdfs per hour, also it has memory leaks, it uses lot of resources, it is killing other process with OutOfMemory errors.
Attachments
Attachments
Issue Links
- is related to
-
PDFBOX-3727 "premature EOF, image will be incomplete"
- Closed