Issue with HTML to PDF conversion on UNIX

Hi,

I am using Aspose.Words for Java 4.0 .3.I am getting this exception on when i am trying to convert to PDF

java.lang.NullPointerException
at asposewobfuscated.jz.eV(Directory.java: 87)
at asposewobfuscated.qx.a(TTFontFiler.java: 788)
at asposewobfuscated.qx.iG(TTFontFiler.java: 763)
at asposewobfuscated.qx.Vp(TTFontFiler.java: 752)
at asposewobfuscated.qx.iA(TTFontFiler.java: 321)
at asposewobfuscated.qx.C(TTFontFiler.java: 117)
at asposewobfuscated.qx.B(TTFontFiler.java: 42)
at asposewobfuscated.oa.hc(PalFont.java: 24)
at com.aspose.words.xk.Ho(SpanPr.java: 231)
at com.aspose.words.sl.rs(Span.java: 730)
at com.aspose.words.sl.getWidth(Span.java: 593)
at com.aspose.words.zy.JJ(LineBuilder.java: 88)
at com.aspose.words.zy.JI(LineBuilder.java: 30)
at com.aspose.words.bx.V(LinePart.java: 281)
at com.aspose.words.k.c(ColumnBuilder.java: 481)
at com.aspose.words.k.a(ColumnBuilder.java: 163)
at com.aspose.words.k.a(ColumnBuilder.java: 97)
at com.aspose.words.mz.a(PageBuilder.java: 119)
at com.aspose.words.mz.a(PageBuilder.java: 60)
at com.aspose.words.ajt.b(SectionReflower.java: 40)
at com.aspose.words.io.nG(MainTextSectionLayout.java: 757)
at com.aspose.words.qr.nG(StoryLayoutBase.java: 88)
at com.aspose.words.mx.nG(PageLayoutModel.java: 124)
at com.aspose.words.zh.a(LayoutDocument.java: 33)
at com.aspose.words.Document.updatePageLayout(Document.java: 1651)
at com.aspose.words.Document.IF(Document.java: 1604)
at com.aspose.words.Document.getPageCount(Document.java: 1632)
at com.aspose.words.Document.a(Document.java: 1457)
at com.aspose.words.Document.save(Document.java: 970)
at com.authoria.service.DocumentMgr.convertHTMLToPDF(DocumentMgr.java:233)

I am using the following code

inputStream = new ByteArrayInputStream(html.getBytes()); //Read the string into bytes.
initializeAspose(); // Initialize the Aspose library.
Document doc = new Document(inputStream, "", LoadFormat.HTML, ""); //Get the document instantiated.
outputStream = new ByteArrayOutputStream();
doc.save(outputStream, SaveFormat.PDF); //Write the doc into an output stream.
return outputStream.toByteArray(); //Return byte array from output stream.

I am passing simple html to this code : test
I am getting this issue only on LINUX.

Hello

Thanks for your request. Please try to specify TrueTypeFontsFolder and please make sure that this folder contains fonts. TrueTypeFontDirectory should contain fonts, which are using in your document. At least this folder should contain one valid TrueType font.

PdfOptions opt = new PdfOptions();
opt.setTrueTypeFontsFolder("usr/share/fonts/msttcorefonts");
doc.saveToPdf(0, doc.getPageCount(), "out.pdf", opt);

Best regards,