Pdf.save fails with NullPointerException when TrueType fonts directory contains a subdirectory

Aspose.Pdf 2.7.0.

Code:

Workbook wb = new Workbook();
wb.loadData(stream);
wb.save("temp.xml", FileFormatType.ASPOSE_PDF);
Pdf pdf = new Pdf();
pdf.setTruetypeFontDirectoryPath("c:\\fonts"); // directory contains empty sub-directory
pdf.bindXML("temp.xml", null);
pdf.save("temp.pdf");

Stack trace:

java.lang.NullPointerException
at aspose.pdf.pdftext.Aax.b(SourceFile:256)
at aspose.pdf.pdftext.Acb.a(SourceFile:593)
at aspose.pdf.xml.Abo.b(SourceFile:269)
at aspose.pdf.xml.Ack.a(SourceFile:476)
at aspose.pdf.xml.Aca.a(SourceFile:759)
at aspose.pdf.xml.Aaq.a(SourceFile:105)
at aspose.pdf.xml.Aaz.a(SourceFile:112)
at aspose.pdf.Pdf.save(SourceFile:911)

Hello Sergey,

Thanks for using our products.

I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFJAVA-19578. We will investigate this issue in details and will keep you updated on the status of a correction.

FYI, you may try using the Direct-to-PDF conversion method of Aspose.Cells for Java which does not require Aspose.Pdf for Java to complete this job. For more related information, please visit Converting to PDF Files

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

We apologize for your inconvenience.