I’m using the Aspose for converting Doc to PDF . I’m using the following code for converting the PDF file . It works fine at Windows environment. When i test this code at solaris environment, getting the Null pointer Exception at saveToPdf method.
Document doc = new Document(wordFilePath);
Thanks for your inquiry.
Could you please post the full stack trace of the exception that you are getting?
This may be a problem with the rendering engine not being able to find the fonts to use when saving. Please try using the code below. The directory in the setTrueTypesFontsFolder should point towards where your fonts are installed on the server.
Document doc = new Document("in.doc");
PdfOptions opt = new PdfOptions();
doc.saveToPdf(0, doc.getPageCount(), "out.pdf", opt);
I have verifed the /usr/share/fonts in solaris and found the following list.
$ ls -al
drwxr-xr-x 3 root other 512 Feb 2 2009 .
drwxr-xr-x 62 root sys 1536 Feb 2 2009 …
drwxr-xr-x 2 root other 512 Jan 19 2009 pfbs
i haven’t tested the code at Solaris after adding the setTryeTypeFintsFolder. Do you want to me install any other fonts.
Thanks for this additional information.
I believe that currently Aspose.Words only searches for fonts in the root directory, so you should ensure that all .ttf fonts go in the root of that directory instead of being in sub folders. Also please make sure all fonts you are using can be found in this directory, including Times New Roman even if you are not using it in your document.
Thanks for quick response.
Where can i download the microsft fonts for Solaris Env . This is very urgent and i have to show the demo to client today.
I believe you can download the fonts using the instructions found on this site here.
If you have any further queries please feel free to ask.