pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: PDFBOX 2.0.0 : PDF to Image conversion issue in JAVA 7
Date Thu, 03 May 2018 07:35:57 GMT
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)

Tilman


Am 03.05.2018 um 09:03 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.
>
>
> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message