Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Wed Jun 07, 2023 4:23 pm

Hi,
We use SpireDoc for Java (11.5.5).
Code: Select all
    public ByteArrayInputStream getFileContent(String file) {
        Document document = new Document(file);
        document.getComments().clear();
        document.acceptChanges();
        ByteArrayOutputStream fileOut = new ByteArrayOutputStream();
        document.saveToStream(fileOut, FileFormat.PDF);
        return new ByteArrayInputStream(fileOut.toByteArray());
    }


This code failed on Linux with error:
java.lang.NullPointerException
at com.spire.doc.Document.spr⑆╀—(Unknown Source)
at com.spire.doc.Document.spr┍╁—(Unknown Source)
at com.spire.doc.Document.spr▐╁—(Unknown Source)
at com.spire.doc.Document.spr•”(Unknown Source)
at com.spire.doc.Document.spr▄╀—(Unknown Source)
at com.spire.doc.Document.saveToStream(Unknown Source)

But on Windows it working without any error.

Attached input file and pdf from Windows.

Thanks,
Andrei Chorin

andrei.chorin
 
Posts: 48
Joined: Sun Jan 08, 2023 2:36 pm

Thu Jun 08, 2023 3:19 am

Hi,

Thanks for your feedback.
After conducting tests, we were not able to reproduce the issue you described. The conversion process did not throw any exceptions, and we obtained the correct results on both Windows and Linux operating systems. We have attached a sample JAR file of our test code for you to test on your Linux system. Please ensure that the test document and JAR file are placed in the same directory.

If the issue persists after testing, could you please provide us with the following details:

1)The distribution/version of the Linux operating system you are using
2)The version of the Java Development Kit (JDK) installed on your system
This information will help us to further investigate the issue and find a solution.

Thank you for your cooperation and patience in resolving this matter. Please let us know if you have any further questions or concerns.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.Doc