OpenPDF icon indicating copy to clipboard operation
OpenPDF copied to clipboard

Convert pdf pages to images

Open bhupendersinghh opened this issue 3 years ago • 7 comments

Does openPdf support conversion of pdf file pages to images or a way to generate thumbnails for pdf files?

bhupendersinghh avatar Oct 25 '21 14:10 bhupendersinghh

I investigate the same issue time ago... actually this functionalit is not supported then I'm forced to use also the PDFBox lib in my application to support this feature

alesky78 avatar Dec 10 '21 15:12 alesky78

hello, is there anyone working on this enhancement? I am interested in it and want to try it.

ObsisMc avatar Mar 10 '22 06:03 ObsisMc

hello, is there anyone working on this enhancement? I am interested in it and want to try it.

I'm not sure anyone is. I had to use pdfbox because of this

bhupendersinghh avatar Mar 10 '22 06:03 bhupendersinghh

@asturio hello, is there anyone working on this issue? If not, I can have a try.

ObsisMc avatar Mar 10 '22 06:03 ObsisMc

Here is a one way to create a thumbnail of pdf page - PdfReader reader = new PdfReader("HelloWorldToImport.pdf"); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("HelloWorldImportedPages.pdf")); document.open(); System.out.println("Tampered? " + reader.isTampered()); document.add(new Paragraph("This is page 1:")); PdfImportedPage page = writer.getImportedPage(reader, 1); Image image = Image.getInstance(page); image.scalePercent(15f); image.setBorder(Rectangle.BOX); image.setBorderWidth(3f); image.setBorderColor(new GrayColor(0.5f)); document.add(image); System.out.println("Tampered? " + reader.isTampered()); document.close(); image

bk1991 avatar Apr 28 '22 10:04 bk1991

Hello @bk1991 thank you for your update, this is an interesting approach but doesn't solven the problem of this topic. The point here is to convert a pdf page in a immage: jpeg, png, etc....

alesky78 avatar May 03 '22 07:05 alesky78

Any help on this issue would be welcome. Please submit a pull request.

andreasrosdal avatar Jun 15 '22 22:06 andreasrosdal