There is a pdf file, and I want to import the 2nd page as an image and save it to a jpeg file. Is it possible and how to do it?
This is the code how I import a 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 image
instance, but I don't know how to write it to a jpeg file.