Free Support Forum - aspose.com

Getting NullPointer with using loadExternalFonts in Java

Hi,

I use the following Java Program on AIX:
logger.info("FontsDir: "+fontDir);
String[] _fontDir = new String[] {fontDir};
FontsLoader.loadExternalFonts(_fontDir);
InputStream _is = new FileInputStream(_inputFileName);
PresentationEx _presentation = new PresentationEx(_is);
com.aspose.slides.export.PdfOptions _pdfSaveOptions = new com.aspose.slides.export.PdfOptions();
_pdfSaveOptions.setCompliance(com.aspose.slides.export.PdfCompliance.PDF_15);
_pdfSaveOptions.setSaveMetafilesAsPng(false);
_pdfSaveOptions.setTextCompression(com.aspose.slides.export.PdfTextCompression.NONE); ByteArrayOutputStream _byteAOs = new ByteArrayOutputStream();
FileOutputStream _fos=null;
try {
_presentation.save(_byteAOs, com.aspose.slides.export.SaveFormat.PDF, _pdfSaveOptions);

I get the NullPointer Exception as in the attachment. The Presentation I also send to you as attachment.
Is it a bug or do I have a coding problem.

By the way, the same Program running on Windows 7 works fine.

Any help welcome.

best regards,

Igor


Hi Lgor,


Thanks for your interest in Aspose.Slides.

I have observed the presentation file shared by you. Can you please share the fonts used in your presentation. If you are using Open Type fonts then I regret to share that at the moment the support for Open Type fonts is currently unavailable in Aspose.Slides.

Many Thanks,

Hi,


thank you for your quick response. We do use true type fonts, but there are also other font type within the directory. As I wrote, the solution works on Windows Machine, but does not work on AIX with the same set of fonts. I will clean the directory, so that only true type fonts will be available.

best regards,

Igor

Hi,


I did some testing.

I my font directory is empty, I do not get the NullPointerException at loadExternalFonts. If I put one TrueType Fonts, I still get the NullPointerException. I share with you the Font File (see Attachment), can you reproduce the problem on AIX?

best regards,

Igor

Hi Lgor,


I would suggest you to please try loading the custom font from location by removing the True Type fonts from target directory. If there is still an issue with other fonts then please share the fonts with us and I will try to reproduce the issue on my end to help you further.

Many Thanks,

Hi,


thank you for your help.

I use now Aspose.slides for Java Version 3.0 but I do not find anymore the FontsLoader nor something similar.

So let’s close this case and let’s concentrate on the other case which is still open.

best regars,

Igor

Hi Lgor,


I have created an issue with ID SLIDESJAVA-33568 in our issue tracking system to provide FontLoader support in Aspose.Slides for Java. Actually, this new version has been auto ported from Aspose.Slides for .NET so this FontLoader has been missed in this release.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESJAVA-33568) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.