pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkuehler <andr...@lehmi.de>
Subject Re: PDFBOX 2.0.2 : PDF to Image conversion issue in JAVA 7
Date Fri, 04 May 2018 16:02:12 GMT
Am 04.05.2018 um 07:57 schrieb Ram Kumar:
>   Dear All,
> 
> I want to convert a PDF page to the image file. The text is missing when I
> convert a PDF page to image using java.
> Please help me to resolve this issue.
Tilman already answered your question in the other thread you've opened yesterday.

Here again his answer from the other thread, which is still valid for 2.0.2:

1) The current version is 2.0.9, not 2.0.0.
2) both versions will bring an error message that you don't have the jbig2 
decoder. If you didn't see the error message then something is seriously wrong 
with your logging
3) if you used the pdfbox-app 2.0.9 then the jbig2 decoder is included
4) if not, then read https://pdfbox.apache.org/2.0/dependencies.html
5) in the future, be careful including confidential documents. (yours was stuck 
in moderation)


Regards
Andreas

> 
> 
> The sample file enclosed in attachments and code is as follows -
> 
> public void pdfToImageConvertorUsingPdfBox(String inputPdfPath) throws
> Exception {
> File sourceFile = new File(inputPdfPath);
> String formatName = "png";
> if (sourceFile.exists()) {
> PDDocument document = PDDocument.load(sourceFile);
> PDFRenderer pdfRenderer = new PDFRenderer(document);
> int count = document.getNumberOfPages();
> 
> for (int i = 0; i < count; i++) {
> BufferedImage image = pdfRenderer.renderImageWithDPI(i, 200, ImageType.RGB);
> String output = FilenameUtils.removeExtension(inputPdfPath) + "_" + (i + 1)
> + "." + formatName;
> ImageIO.write(image, formatName, new File(output));
> }
> document.close();
> } else {
> logger.error(sourceFile.getName() + " File not exists");
> }
> }
> 
> 
> Best Regards,
> Ram Kumar
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message