I cannot compile this example: Convert PDF to Images formats|Aspose.PDF for Java
The error message is:
ConvertPdf.java:18: expected
jpegDevice.process(pdfDocument.getPages().get_Item(1), imageStream);
^
ConvertPdf.java:20: expected
imageStream.close();
^
I set the classpath as follows:
export -s CLASSPATH=/home/hp/java/aspose-pdf-jdk14.jar
This is my sourcecode:
import java.io.*;
class ConvertPdf {
//open document
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(“input.pdf”);
// create stream object to save the output image
java.io.OutputStream imageStream = new java.io.FileOutputStream(“Converted_Image.jpg”);
//create JPEG device with specified attributes
//Quality [0-100], 100 is Maximum
//create Resolution object
com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(300);
//create JpegDevice object where second argument indicates the quality of resultant image
com.aspose.pdf.devices.JpegDevice jpegDevice = new com.aspose.pdf.devices.JpegDevice(resolution, 100);
//convert a particular page and save the image to stream
jpegDevice.process(pdfDocument.getPages().get_Item(1), imageStream);
//close the stream
imageStream.close();
}