OpenPDF
OpenPDF copied to clipboard
Convert pdf pages to images
Does openPdf support conversion of pdf file pages to images or a way to generate thumbnails for pdf files?
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
hello, is there anyone working on this enhancement? I am interested in it and want to try it.
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
@asturio hello, is there anyone working on this issue? If not, I can have a try.
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();
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....
Any help on this issue would be welcome. Please submit a pull request.