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.

Tue Sep 08, 2020 2:52 pm

Hello,
I am using spire.pdf.free 2.6.4 library. I am trying to convert the document to HTML format to show it in a viewer, in Windows it works fine but in Linux it shows me an exception. Below more details:

Application Server: Red Hat 7.5

Exception:

(default task-8) java.lang.NullPointerException
at com.spire.pdf.packages.sprLma.spr (Unknown Source)
at com.spire.pdf.packages.sprLma.spr (Unknown Source)
at com.spire.pdf.packages.sprLma.spr  (Unknown Source)
at com.spire.pdf.packages.spryYa.spr (Unknown Source)
at com.spire.pdf.packages.spryYa.spr (Unknown Source)
at com.spire.pdf.packages.spryYa.spr (Unknown Source)
at com.spire.pdf.packages.spryYa.spr  (Unknown Source)
at com.spire.pdf.packages.spryYa.spr  (Unknown Source)
at com.spire.pdf.PdfDocumentBase.spr (Unknown Source)
at com.spire.pdf.PdfDocumentBase.spr (Unknown Source)
at com.spire.pdf.packages.sprtkb.spr (Unknown Source)
at com.spire.pdf.packages.sprDlb.spr (Unknown Source)
at com.spire.pdf.PdfDocumentBase.spr (Unknown Source)
at com.spire.pdf.PdfDocumentBase.spr  (Unknown Source)
at com.spire.pdf.PdfDocument.saveToStream(Unknown Source)

Code: Select all
[b]pom.xml:[/b]

<repositories>
   <repository>
           <id>com.e-iceblue</id>
      <name>e-iceblue</name>
      <url>http://repo.e-iceblue.com/nexus/content/groups/public/</url>
   </repository>
</repositories>
<dependency>
   <groupId>e-iceblue</groupId>
   <artifactId>spire.pdf.free</artifactId>
   <version>2.6.4</version>
   <scope>compile</scope>
</dependency>

[b]Class java:[/b]

private String generateImageFromPDF(byte[] file) {
    PdfDocument pdf = new PdfDocument();
    pdf.loadFromBytes(file);
    // convert the PDF to one SVG
    pdf.getConvertOptions().setPdfToHtmlOptions(true);
    // Save to SVG image
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    pdf.saveToStream(baos, FileFormat.HTML);
    return Base64.getEncoder().encodeToString(baos.toByteArray());
  }


Thanks in advance.

avergarayb
 
Posts: 1
Joined: Tue Sep 08, 2020 1:42 pm

Wed Sep 09, 2020 5:54 am

Hello,

Thanks for your inquiry.
To help us investigate your issue more accurately, please provide your PDF file and tell us your JDK version. You may upload your file here or send it to us ([email protected]) via email. Thanks in advance.
Besides, I suggest you can test your case with our latest commercial version Spire.PDF for Java Version:3.8.5, as it is more stable and contains more bug fixes.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Thu Sep 10, 2020 10:03 am

Hello,

Thanks for providing your file via email.
I tested your file but still didn’t reproduce your issue. This is my executable .jar file, please run it directly and then tell us your test result. If the issue still happens, please provide the download link of the installation package for your system. Then we will configure the environment for further verification.
Besides, have you tested the latest commercial version Spire.PDF for Java Version:3.8.5? What’s the result? Looking forward to your response.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Return to Spire.PDF

cron