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

I tried to use direct conversion but it also fails.

java.lang.NullPointerException
at com.aspose.cells.a.a.d.w.(Unknown Source)
at com.aspose.cells.a.a.d.K.(Unknown Source)
at com.aspose.cells.a.a.d.w.a(Unknown Source)
at com.aspose.cells.a.a.d.J.a(Unknown Source)
at com.aspose.cells.a.a.d.N.a(Unknown Source)
at com.aspose.cells.a.a.d.g.a(Unknown Source)
at com.aspose.cells.a.a.d.d.a(Unknown Source)
at com.aspose.cells.a.a.a.i.a(Unknown Source)
at com.aspose.cells.a.a.a.e.a(Unknown Source)
at com.aspose.cells.a.a.a.n.a(Unknown Source)
at com.aspose.cells.a.a.i.r.a(Unknown Source)
at com.aspose.cells.a.a.d.d.a(Unknown Source)
at com.aspose.cells.a.a.i.w.a(Unknown Source)
at com.aspose.cells.Workbook.save(Unknown Source)

Code:

Workbook wb = new Workbook();
wb.open("C:\\temp\\test.xls");
wb.save("C:\\temp\\test.pdf", FileFormatType.PDF);

How do I specify fonts directory when using Direct-to-PDF conversion method?

Thank you

Hello Sergey,

Our development team will look into the details of issue PDFJAVA-19578 reported earlier. However, the problem related to Direct-to-PDF conversion using Aspose.Cells is directly related to Aspose.Cells product, so I am going to move this query to Aspose.Cells forum. I hope our team of experts taking care of that product would be in better position to answer this query.

We apologize for your inconvenience.

Hi,

Please post your template “test.xls” file here, we will check your issue soon.

Thank you.

Hi Sergey,

In the mean while please try the following line of code:

Workbook.getSaveOptions().setFontPath(String[] paths)

Where the paths is the array of all directories that contains the font files.

Thanks,

Conversion worked after I set fonts path using Workbook.getSaveOptions().setFontPath.

Could you add an improvement and throw exception with a meaninful message when fonts directory cannot be found?

Thanks a lot!

Nayyer,

Would it be possible to provide a hotfix for PDFJAVA-19578?
For Excel conversion I can use direct save to pdf, but we have other code which creates PDF files from scratch and fails because of this issue.

Thank you.