Saving pdf document to doc(x) causes NullPointerException


When trying to save the attached pdf file as doc(x), a NullPointerException is thrown back.

Version: 10.2.0 for Java.
Error reproduced on: Ubuntu and Red Hat Linux.
Example code:
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("/emd-2009-043098.pdf");"/tmp/tempname.doc", SaveFormat.DocX);

Hi Tor,

Thanks for your inquiry. We are looking into it and will update you soon.

Best Regards,

Hi Tor,

We are sorry for the delayed response. As on non-Windows OSs we need to set font path according to the system before any processing. So I have tested the scenario over Ubuntu as following but I am getting Font file exception instead NullPointerException and logged a ticket PDFNEWJAVA-34962 for further investigation and rectification. We will keep you updated about the issue resolution progress.

// Set font folder path<o:p></o:p>

String path = "/usr/share/fonts/truetype/msttcorefonts/";

// seting the user list for standard font directories

java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();


// Open the source PDF document

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("emd-2009-043098.pdf");

// Save the file into Microsoft document format"emd-2009-043098.doc",SaveFormat.Doc);


Exception in thread "main" File not found File: /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf

File name: '/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf' ---> /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf (Too many open files)

com.aspose.pdf.internal.p494.z3.(Unknown Source)

com.aspose.pdf.internal.p494.z3.(Unknown Source)

com.aspose.pdf.internal.p494.z3.(Unknown Source)

com.aspose.pdf.internal.p364.z28.(Unknown Source)

com.aspose.pdf.internal.p364.z28.(Unknown Source)

com.aspose.pdf.internal.p364.z28.(Unknown Source)

com.aspose.pdf.internal.p364.z14.m6(Unknown Source)

com.aspose.pdf.internal.p94.z140.getFontStreamInternal(Unknown Source)

com.aspose.pdf.internal.p94.z140.getFontStream(Unknown Source)

com.aspose.pdf.internal.p585.z29.m27(Unknown Source)

com.aspose.pdf.internal.p574.z1.m1(Unknown Source)

com.aspose.pdf.internal.p574.z5.m1(Unknown Source)

com.aspose.pdf.internal.p564.z7.m3(Unknown Source)

com.aspose.pdf.internal.p564.z7.m4(Unknown Source)

com.aspose.pdf.internal.p564.z7.m2(Unknown Source)

com.aspose.pdf.internal.p564.z7.m2(Unknown Source)

com.aspose.pdf.ApsUsingConverter.m1(Unknown Source)

com.aspose.pdf.ApsUsingConverter.m2(Unknown Source)

com.aspose.pdf.z19.m1(Unknown Source)

com.aspose.pdf.ADocument.m1(Unknown Source)

com.aspose.pdf.Document.m1(Unknown Source)

com.aspose.pdf.ADocument.m2(Unknown Source)

com.aspose.pdf.Document.m2(Unknown Source) Source) Source)

We are sorry for the inconvenience caused.

Best Regards,

Hi Tor,

Thanks for your patience.

The development team has further investigated the issue reported earlier as PDFNEWJAVA-34962 and as per our observations, it does not seem to be an issue in our API. In fact this is a default open file limit of some Linux distributions. Therefore you need to increase open file limit over respective Operating System.

Below are some links for setting up open file limits for Red Hat Linux and Ubuntu:

Red Hat




Thank you for the update, i will look into it!