ClassCastException when trying to convert PDf to TIFF

Hi,

I’m attempting to convert a PDF to a TIFF. When running standalone this process works without issue. However, when I run the same process on our app server (WebSphere 6.1) I run into this exception:

Caused by: java.lang.ClassCastException: com.ibm.ws.classloader.Handler$ClassLoaderURLConnection incompatible with java.net.JarURLConnection
at com.aspose.pdf.kit.ResourceLoader.loadResource(Unknown Source)
at com.aspose.pdf.kit.rm.(Unknown Source)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)

Hi Jim,

We have fixed a similar scenario in our latest version of Aspose.Pdf.Kit for Java. Please download the latest version (3.4.0) and try at your end. If you still find the same problem then please share the input PDF file with us, so we could test the issue at our end.

We’re sorry for the inconvenience.
Regards,

Tried 3.4.0 and now I’m running into a new issue…

java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:218)
at com.aspose.pdf.kit.n.a(Unknown Source)
at com.aspose.pdf.kit.n.a(Unknown Source)
at com.aspose.pdf.kit.PdfConverter.saveAsTIFF(Unknown Source)
at com.farrow.imaging.conversion.AsposePdf2TiffConverter.convert(AsposePdf2TiffConverter.java:30)
at com.farrow.imaging.conversion.Txt2PdfConverter.convert(Txt2PdfConverter.java:53)
at com.farrow.dms.service.incoming.loading.DocumentLoadingServiceImpl.convertDocs(DocumentLoadingServiceImpl.java:171)
at com.farrow.dms.service.incoming.loading.DocumentLoadingServiceImpl.loadFax(DocumentLoadingServiceImpl.java:74)
at com.farrow.dms.service.incoming.email.EmailLoadingServiceImpl.loadEmails(EmailLoadingServiceImpl.java:116)
at com.farrow.dms.service.incoming.email.EmailMonitor.executeInternal(EmailMonitor.java:32)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.springframework.scheduling.commonj.DelegatingWork.run(DelegatingWork.java:61)
at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1114)
at com.ibm.ws.asynchbeans.WorkWithExecutionContextImpl.go(WorkWithExecutionContextImpl.java:195)
at com.ibm.ws.asynchbeans.CJWorkItemImpl.run(CJWorkItemImpl.java:187)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
Caused by: java.lang.ClassCastException: com.sun.media.jai.imageioimpl.ImageReadWriteSpi incompatible with javax.media.jai.OperationRegistrySpi
at javax.media.jai.OperationRegistry.registerServices(Unknown Source)
at javax.media.jai.ThreadSafeOperationRegistry.registerServices(Unknown Source)
at javax.media.jai.OperationRegistry.initializeRegistry(Unknown Source)
at javax.media.jai.JAI.(Unknown Source)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:196)
… 16 more

Hi Jim,

Please share the input PDF file with us, so we could test the issue at our end. You’ll be updated with the results accordingly.

We’re sorry for the inconvenience.
Regards,

Shahza,

I’m not longer running into exceptions when converting documents. However all the tiffs outputted are missing baseline tiff metadata. Can you please investigate as to whether or not you can implement this metadata: Baseline TIFF Tags. Specifically interested in X/Y Resolution tags.

This is the code I’m using to convert:
public void convert(InputStream in, OutputStream out) throws Exception {

PdfConverter converter = new PdfConverter();
converter.bindPdf(in);
converter.setResolution(150);
converter.doConvert();
converter.saveAsTIFF(out);
}


Alternatively, returning a BufferedImage for each page instead of your API writing each image would afford us the ability to control how these images are written.

Hi Jim,

I’m afraid, currently saveAsTIFF method doesn’t allow you to specify X and Y resolution; however, I can log this requirement for our development team to support in future. Could you please share which other attributes you’re interested to specify, so our team would be clear regarding your requirement.

We’re sorry for the inconvenience.
Regards,

Shahzad,

It’s not that I want to specify the X/Y Res. Your API already provides a method to specify the resolution. What I’m looking for is for your API to include the standard tiff tags written in the metadata with the image.

An alternate solution would be to return a java.awt.image.BufferedImage so that I can chose write the image out myself

Thanks for you help,

Jim

Hi Jim,

I have logged both of these requirements to either support the standard TIFF tags (PDFKITJAVA-20572) or to return BufferedImage (PDFKITJAVA-20573). Our team will investigate both of these requirements and you’ll be updated via this forum thread once both of these features or any one of them is supported.

We’re sorry for the inconvenience and appreciate your patience.
Regards,