If you have any complaints or suggestions about our service or products, please post them here. Your comments will help us to make continuous progress.

Wed Aug 21, 2024 8:05 am

I have this basic Java code to compress PDF files.

Code: Select all
LicenseProvider.setLicenseKey("<License_Key>");
PdfCompressor compressor = new PdfCompressor("<Input_File_Path>");
TextCompressionOptions textCompression = compressor.getOptions().getTextCompressionOptions();
textCompression.setCompressFonts(true);

ImageCompressionOptions imageCompression = compressor.getOptions().getImageCompressionOptions();
imageCompression.setImageQuality(ImageQuality.Low);

compressor.compressToFile("<Output_Path>");


When I run it, I get this error for certain PDFs (It might have to do with PDFs having images). I have attached one such PDF
sample.zip
that was causing this. It's working fine for most other PDFs.

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/image/codec/jpeg/JPEGCodec
at com.spire.pdf.packages.sprkzo.spr┨▁(Unknown Source)
at com.spire.pdf.packages.sprkzo.spr▊▁(Unknown Source)
at com.spire.pdf.packages.spryxo.spr㈮⃞▁(Unknown Source)
at com.spire.pdf.packages.sprduo.spr┍╿(Unknown Source)
at com.spire.pdf.packages.sprszo.spr╸▁(Unknown Source)
at com.spire.pdf.packages.sprszo.spr⅔▁(Unknown Source)
at com.spire.pdf.conversion.compression.PdfCompressor.compressToFile(Unknown Source)
at com.search.snippets.SnippetsApplication.main(SnippetsApplication.java:79)
Caused by: java.lang.ClassNotFoundException: com.sun.image.codec.jpeg.JPEGCodec
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 8 more

I haven't been able to handle this with exception handling as well. It still fails and halts the entire program (which is basically just this code looped over various PDFs).

Some details which you might need -
Windows 10 Enterprise - 64-bit (Region - US)
SpirePDF for Java Version - 10.7.3
Running it on Java 8 with SpringBoot (JDK 1.8.0_402).

We did notice that this code was working fine on JDK version 1.8.0_261. So this just might be an issue related to the JDK used.
For our use case we would be running the code on a Databricks Compute (which has some version of Java 8 JDK) and we can't modify the exact JDK version there. So we require the code to be able to run on different minor versions of Java 8.

Please let me know if you need anything else.

Thanks for your support.

-Hrusikesh

hrusikesh
 
Posts: 3
Joined: Wed Aug 21, 2024 7:18 am

Thu Aug 22, 2024 4:01 am

Hi,

Thank you for bringing this issue to our notice.
I have successfully replicated the problem you mentioned and logged it into our bug tracking system with the reference ID SPIREPDF-6994. Our development team will investigate and address this issue promptly. To ensure a smooth user experience post-resolution, we kindly ask that you provide us with the JDK version you are currently using, so that we can incorporate it into our testing process. Your assistance in this regard is greatly appreciated. Thank you in advance!

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 330
Joined: Mon Nov 07, 2022 8:10 am

Thu Aug 22, 2024 7:19 am

Thanks for the quick response. Glad to know you are working on it, as this is impeding our production.
As for the JDK version, since we are running it on the Databricks platform (9.1 LTS), I've checked the documentation and it mentions Java version as - Zulu 8.56.0.21-CA-linux64

Going through the Azul Zulu website, it seems the JDK version corresponding to this is - 8u302b08

Hope that is helpful. Let me know, if there's anything else you need. Also, could you kindly let me know, if there's a way to track the progress on this bug? Thanks again.

-Hrusikesh

hrusikesh
 
Posts: 3
Joined: Wed Aug 21, 2024 7:18 am

Thu Aug 22, 2024 8:39 am

Hi,

Thank you for your information.
I'm sorry, but the bug tracking system is our internal system and cannot be opened to the public. We will take the initiative to give you feedback after the problem is fixed.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 330
Joined: Mon Nov 07, 2022 8:10 am

Fri Aug 23, 2024 1:00 pm

Understood. Thanks a lot for your support. Looking forward to the fix version.

-Hrusikesh

hrusikesh
 
Posts: 3
Joined: Wed Aug 21, 2024 7:18 am

Fri Sep 06, 2024 10:15 am

Hi,

Thanks for your patience!
Glad to inform you we just released a new version Spire.PDF, which contains the fix of your issue, please download from the following link to test.

Download: https://www.e-iceblue.com/Download/pdf-for-java.html

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 330
Joined: Mon Nov 07, 2022 8:10 am

Return to Complaints & Suggestions

cron