Would like to know if someone has or had this problem.
I would like to generate a PDF using aspose and java. In a windows SO the result is ok (as image01.png shows). When I install the software in a Linux SO (SUSE) the pdf is not ok (as image02.png shows).
An aditional information, if a generate a doc instead of pdf in Linux the doc is ok (as image03.png shows).
Thanks for your inquiry. I would suggest you please upgrade to the latest version of Aspose.Words for Java (14.11.0) and see how it goes on your end. I hope this helps.
Also, please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats such as PDF, XPS or SWF. Please install the required fonts on your linux machine and refer to the following articles for details:
In case the problem still remains, please attach your input Word document and output PDF file showing the undesired behavior here for testing. We will investigate the issue on our side and provide you more information.
Thanks for your inquiry. Please attach your input Word document and output PDF file showing the undesired behavior here for testing. We will investigate the issue on our side and provide you more information.
Thanks for the additional information. After an initial test with Aspose.Words for Java 14.11.0 over Linux Enviroment, I was unable to reproduce this issue on my side. I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link. I hope, this helps.
Secondly, you can find various members in FontSettings class particularly FontSettings.DefaultFontName property. Also, you can get notifications of missing fonts and font substitution during rendering. Please refer to the following article:
Hi Awais, I discover the problem. My code to generate the PDF is here:
ByteArrayInputStream imagem = new ByteArrayInputStream(emissaoContrato.getMinuta().getImagem());
Document doc = null;
try
{
doc = new Document(imagem);
}
catch (Exception e)
{
LOG.error(e.getMessage(), e);
throw new ServiceException(e);
}
FontSettings.setDefaultFontName(“Courier”);
doc.save(outputStream, SaveFormat.PDF);
I’ve tried in 3 Linux SO (the same version of JVM, ASPOSE e Container WEB). The problem is, using the code above the PDF doesn’t assume the Font setted.
How is possible forcing the exact Font to generate the PDF (that exists in Linux SO) ?
Thanks for your inquiry. First off, please make sure that Aspose.Words is able to pick fonts from following default locations in your Linux environment.
/usr/share/fonts
/usr/local/share/fonts
/usr/X11R6/lib/X11/fonts
When running the code from here, have you noticed any warning messages being generated by Aspose.Words?
You can copy required fonts in one directory on your Linux machine and instruct Aspose.Words to use fonts from this location using FontSettings.setFontsFolder method. It could be that your Linux distribution contains old version of Courier font, and you can try copying latest version of this font from Windows machine into Linux machine. I hope, this helps.