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.

Mon Jul 07, 2025 10:37 am

Dear support,
I'm trying to convert a PDF file to HTM using java library - (spire.office 10.1.0) - with the following code :

Code: Select all
   PdfDocument doc = new PdfDocument();
            doc.loadFromStream(Files.newInputStream(originalFile));
              //Load a sample PDF document
            OutputStream returnedOutputStream = Files.newOutputStream(returnedFile) ;
            if (expectedFileFormat.equals(com.spire.pdf.FileFormat.SVG)) {
                doc.getConvertOptions().setOutputToOneSvg(true);
            }

            if (expectedFileFormat.equals(com.spire.pdf.FileFormat.HTML)) {
                doc.getConvertOptions().setPdfToHtmlOptions(true);
            }
            //Convert PDF to Doc and save it to a specified path
            doc.saveToStream(returnedOutputStream, expectedFileFormat);
            doc.close();


I receive the following exception - and no documentation about it.

java.lang.NullPointerException: Cannot invoke "com.spire.pdf.packages.sprghg.spr≂⑊(com.spire.pdf.packages.sprskg)" because "this.spr‼" is null

I uploaded the file in attachement.
Could you help me on this exception ?

Best regards

Steve Favez

steve.favez
 
Posts: 2
Joined: Tue Feb 11, 2025 7:14 am

Tue Jul 08, 2025 3:18 am

Dear Steve,

Thank you for your inquiry.

I have reproduced the issue of incorrect converting and logged it into our issue system under the tracking number SPIREPDF-7608. Our Dev team will do further investigation and fix it. Once there is any progress, we will inform you.
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Thu Sep 25, 2025 9:04 am

Hello,

Thank you for your patience.
We just release official version(Spire.Pdf.Java.11.9.6) which fixed the issue(SPIREPDF-7608), welcome to test. Looking forward to your testing feedback.
Download link: https://www.e-iceblue.com/Download/pdf-for-java.html
Sincerely,
Talia
E-iceblue support team
User avatar

talia.liu
 
Posts: 331
Joined: Mon Apr 14, 2025 3:33 am

Return to Spire.PDF