- 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.
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:
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.
Next, Aspose.Words tries to find a font on the file system with an exact font name match.
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.
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:
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.