There is a pdf file, and I want to import the second page as an image and save it in a jpeg file. Is it possible and how to do this?
This is the code as I import the page:
Document document = new Document(); File file = File.createTempFile("", ""); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file)); document.open(); final int backPage = 2; PdfReader reader = new PdfReader(pdf.getAbsolutePath()); PdfImportedPage importedPage = writer.getImportedPage(reader, backPage); com.lowagie.text.Image image = com.lowagie.text.Image.getInstance(importedPage);
Now I get an instance of image , but I don't know how to write it to a jpeg file.
source share