While converting from pdf to image using aspose, we are getting error in page 2. We have tried with both pngDevice and jpegDevice, still getting the same error
Please let us know the root cause for this issue and possible solution.
Sample Code :
jpegDevice = new JpegDevice(3400, 4400, resolution);
// Convert a particular page and save the image to stream
Page page = pdfDocument.getPages().get_Item(pageCount);
jpegDevice.process(page, byteArrayOutputStream);
S2021011200357_Mask_Sample.pdf.pdf (176.7 KB)
Stacktrace :
class com.aspose.pdf.internal.l9p.lu: Attempted to read past the end of the stream. com.aspose.pdf.internal.l5h.l0n$lI.deserialize(Unknown Source) com.aspose.pdf.internal.l9p.le.deserialize(Unknown Source) com.aspose.pdf.internal.l5h.l1n.lI(Unknown Source) com.aspose.pdf.internal.l9u.lk.lI(Unknown Source) com.aspose.pdf.internal.l9u.ld.lI(Unknown Source) com.aspose.pdf.internal.l2u.lu.lI(Unknown Source) com.aspose.pdf.internal.l2u.lu.lI(Unknown Source) com.aspose.pdf.devices.lI.lI(Unknown Source) com.aspose.pdf.devices.lI.lI(Unknown Source) com.aspose.pdf.devices.ImageDevice.lI(Unknown Source) com.aspose.pdf.devices.JpegDevice.processInternal(Unknown Source) com.aspose.pdf.devices.JpegDevice.process(Unknown Source) PDFToImageConverter.pdfPageToImageConversion(PDFToImageConverter.java:185)