The java conversion seems far slower than the Dotnet offering. This sample file took 31 seconds with the java Aspose.PDF while the Dotnet Aspose.PDF only took 231 milliseconds.
I just downloaded the latest Aspose.Total for java and am using aspose-pdf-9.7.0-jdk16.jar.
Maybe I’m doing something wrong?
This is on a Windows 7 64bit workstation. Here’s my java code.
public static void main(String[] args) throws FileNotFoundException {
long tStart = System.currentTimeMillis();
// Open document
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(“C:\Test\PDF\test.pdf”);
System.out.println(“opened”);
// Create stream object to save the output image
java.io.OutputStream imageStream = new java.io.FileOutputStream(“C:\Test\PDF\test.tiff”);
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.setCompression(CompressionType.CCITT4);
tiffSettings.setDepth(ColorDepth.Format1bpp);
// Create Resolution object
com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(200);
// Create TiffDevice object with particular resolution
com.aspose.pdf.devices.TiffDevice tiffDevice = new com.aspose.pdf.devices.TiffDevice(resolution, tiffSettings);
// Convert a particular page (Page 1) and save the image to stream
tiffDevice.process(pdfDocument,1,4, imageStream);
// Close the stream
try {
imageStream.close();
} catch (IOException e) {
e.printStackTrace();
}
long tEnd = System.currentTimeMillis();
long tDelta = tEnd - tStart;
double elapsedSeconds = tDelta;
System.out.println(elapsedSeconds);
}