We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with Font embedding

Hi.

I’ve made a jar which basically takes these step:
- parse an XML document
- create a words.Document doc = new Document(templateFile); where templateFile is a word 2003 .doc file
- merge some data from XML into Doc
- save the Doc as PDF into a byteArray: doc.save(ByteArrayOutputStream, SaveFormat.PDF);
- load the stream with pdf.kit.PdfContentEditor editor.bindPdf(new ByteArrayInputStream(ByteArray()));
- Attach a file to the pdf editor: editor.createFileAttachment(rect, “XML”, attachPath, 1, “Tag”);
- save the final documento to disk: editor.save(filePath);

“templateFile” is, as said, a Word 2003 document, which contains a couple of different Fonts.

If I execute the jar from NetBeans or from shell (cmd) with “java -jar…” all works fine. If I execute the jar (with the very same command “java -jar…”) with a system() call from within a C cgi-bin, the PDF produced loses all informations about Fonts.

Could it be an Aspose issue?
Thank you very much.

Hi
Sebastian,


Thanks for your inquiry. Please note that Aspose.Words requires TrueType fonts when rendering documents to fixed-page formats (PDF, XPS or SWF). Aspose.Words selects the fonts according to the following process:

  1. Aspose.Words tries to find the required font among the fonts embedded in the original document. Some document formats such as DOCX can contain embedded fonts.
  2. Next, Aspose.Words tries to find a font on the file system with an exact font name match.
  3. If Aspose.Words cannot find a font with the exact name match, Aspose.Words attempts to select the most suitable font from all of the available fonts.
  4. Finally, if Aspose.Words cannot find any fonts on the file system, it renders the document using the free Gentium font that is embedded into the Aspose.Words assembly.

Moreover, I would suggest you please read ‘Rendering and Printing’ section in documentation below:
http://docs.aspose.com/display/wordsjava/Rendering+and+Printing

I hope, this will help.

Best Regards,