Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Sat May 09, 2020 8:50 am

Hi, I've added SpirePDF.jar to the project as a library, then ran the following code:

Code: Select all
package com.company;

import com.spire.pdf.FileFormat;
import com.spire.pdf.PdfDocument;

public class Main {

    public static void main(String[] args) {

        //Load the PDF file
        PdfDocument pdf = new PdfDocument();
        pdf.loadFromFile("C:\\javaprojectfiles\\abc.pdf");
        //Save to HTML format
        pdf.saveToFile("C:\\javaprojectfiles\\abc.html", FileFormat.HTML);
    }
}


I received the following error message:

Code: Select all
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
   at com.spire.pdf.PdfDocument.<init>(Unknown Source)
   at com.company.Main.main(Main.java:12)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
   at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
   at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
   at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
   ... 2 more


please help, thank you

elvago112
 
Posts: 5
Joined: Fri May 08, 2020 11:54 pm

Sat May 09, 2020 9:54 am

Hi,

Thanks for your inquiry.
In order to help us investigate the issue, please provide your pdf file with us.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3044
Joined: Wed Jun 27, 2012 8:50 am

Sat May 09, 2020 3:24 pm

Amy, thanks for your reply. Here is the PDF.

elvago112
 
Posts: 5
Joined: Fri May 08, 2020 11:54 pm

Mon May 11, 2020 7:12 am

Hi,

Thanks for sharing your pdf file.
I used Spire.PDF for Java Version:3.4.2 (it is the latest version now) to convert your pdf file to HTML, it worked smoothly.
If the version you used is not 3.4.2, welcome to download and test it. And could you please tell me the version of JDK you used?

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3044
Joined: Wed Jun 27, 2012 8:50 am

Sat May 16, 2020 3:33 pm

IntelliJ IDEA 2020.1.1 (Community Edition)
Build #IC-201.7223.91, built on April 29, 2020
Runtime version: 11.0.6+8-b765.40 amd64
VM: Open JDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

elvago112
 
Posts: 5
Joined: Fri May 08, 2020 11:54 pm

Mon May 18, 2020 9:48 am

Hi,

Thanks for providing further information.
After investigation, the cause of the error "java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException" is that JDK 9 or later version doesn't provide JAXB jar. So please install jaxb-api jar separately, and then your project will run smoothly.
Code: Select all
<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
</dependency>



Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3044
Joined: Wed Jun 27, 2012 8:50 am

Wed May 20, 2020 9:53 am

Hi,

Hope you are doing well.
Has your issue been resolved?
Looking forward to your feedback.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3044
Joined: Wed Jun 27, 2012 8:50 am

Wed May 20, 2020 5:25 pm

Hi Amy, thanks for your replies! Added the following jars:

jaxb-jxc.jar
jaxb-api.jar
jaxb-core.jar
jaxb-impl.jar
jaxb-xjc.jar

Still receiving the following error:

class com.spire.pdf.packages.sprKJA: Font parsing exception ---> com.spire.pdf.packages.sprLuB: No have this LanguageID
--- End of inner exception stack trace ---
com.spire.pdf.packages.spriJA.spr (Unknown Source)

elvago112
 
Posts: 5
Joined: Fri May 08, 2020 11:54 pm

Thu May 21, 2020 1:34 am

Hi,

Thanks for your feedback.
According to the above error, maybe it is related to the content of your pdf, could you please share your pdf file to help us investigate and resolve it?
Thanks for your assistance in advance.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3044
Joined: Wed Jun 27, 2012 8:50 am

Thu May 21, 2020 2:14 pm

Hi Amy, I have already shared the pdf. Please scroll up, thank you.

elvago112
 
Posts: 5
Joined: Fri May 08, 2020 11:54 pm

Fri May 22, 2020 10:21 am

Hi,

Yes, you did upload your pdf file and I also tested it before. Please forgive my bad memory.
I tested your pdf on the below environment again, but still could not reproduce your issue. I build an executable JAR file for my project, its downloading link is http://www.e-iceblue.com/downloads/atta ... -21517.zip, please try to run it on your side and get back to us about your test result.

IntelliJ IDEA 2020.1 (Ultimate Edition)
Build #IU-201.6668.113, built on April 7, 2020
Runtime version: 11.0.6+8-b765.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

Here is my test code:
Code: Select all
 public static void main(String[] args) {
        String inputFile = "data/abc.pdf";
        String outputFile = "output/abc.html";

        //Open pdf document
        PdfDocument pdf = new PdfDocument();
        pdf.loadFromFile(inputFile);

        //Convert to HTML file
        pdf.saveToFile(outputFile,FileFormat.HTML);
        pdf.close();
    }

This is the settings in pom.xml of my projcet.
Code: Select all
 <repositories>
        <repository>
            <id>com.e-iceblue</id>
            <url>http://repo.e-iceblue.cn/repository/maven-public/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId> e-iceblue </groupId>
            <artifactId>spire.pdf</artifactId>
            <version>3.5.1</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
    </dependencies>

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3044
Joined: Wed Jun 27, 2012 8:50 am

Wed May 27, 2020 10:19 am

Hi,

How did my executable JAR file run on your side? Could you please give us some feedback?
Thanks in advance!


Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3044
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF