We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Non-trappable error

The following outputs an error on the jpegdevice.process command.

java.lang.ArrayIndexOutOfBoundsException: 3
java.lang.ArrayIndexOutOfBoundsException: 3

Can I trap this? it just spits out error to standard output.

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(pd.finalprodpath);
com.aspose.pdf.Document pdf = new com.aspose.pdf.Document();
String base = “”;
for (int pageCount = 1; pageCount <= pdfDocument.getPages().size(); pageCount++)
Page ppage = pdf.getPages().add();
Page spage = pdfDocument.getPages().get_Item(pageCount);
String pend = String.valueOf(pd.stampstart + (pageCount-1));
String newbase = pd.rootname.substring(0,pd.rootname.length() - pend.length());
String subbase = pd.tiffpath + pd.rootname + slash;
File subfile = new File(subbase);
String stamp = newbase + pend;
String outpath = subbase + stamp + “.” + ext;
base = subbase + stamp + “.pdf”;
ByteArrayOutputStream imageStream = new ByteArrayOutputStream();
Resolution resolution = new Resolution(300);
JpegDevice jpegDevice = new JpegDevice(resolution,60);
jpegDevice.process(pdfDocument.getPages().get_Item(pageCount), imageStream);
byte[] data = imageStream.toByteArray();
ByteArrayInputStream bois = new ByteArrayInputStream(data);
com.aspose.pdf.Rectangle rect = spage.getMediaBox();
ppage.addImage(bois, rect);
pdf.convert(“error.log”, PdfFormat.v_1_4, ConvertErrorAction.None);

FYI - this error is with the java version only. Aspose.net works fine.

Hi John,

for using our API’s.<o:p></o:p>

I have tested the scenario and I am able to reproduce the same problem that an exception is being generated during PDF to JPEG conversion. For the sake of correction, I have logged it in our issue tracking system as PDFNEWJAVA-34348. We will investigate this issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.

The issues you have found earlier (filed as PDFNEWJAVA-34348) have been fixed in Aspose.Pdf for Java 9.5.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.