public static void main(String[] args) {
Document pdfDocument = new Document(“eead286f80687373604c64bdcc0f7f6b”);
try {
for (int pageCount = 1; pageCount <= pdfDocument.getPages().size(); pageCount++) {
// Create stream object to save the output image
String outputFilePath = “aaa.jpg”;
final Instant now = Instant.now();
java.io.OutputStream imageStream = new java.io.FileOutputStream(outputFilePath);
Resolution resolution = new Resolution(300);
JpegDevice JpegDevice = new JpegDevice(resolution);
JpegDevice.process(pdfDocument.getPages().get_Item(pageCount), imageStream);
imageStream.close();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
image.png (229.2 KB)
JDK1.8 aspose.pdf 21.6