Dummy Contract.docx (17.0 KB)
DUMMY TEST ASPOSE 2.pdf (29.4 KB)
When we are creating a word document with font family TIMES NEW ROMAN and when the document is getting converted to PDF the Font is getting changed to a generic one, I am attaching a sample word document and PDF document for your reference please look into it.
@Subhadeep Most likely the problem on your side occurs because fonts required for building document layout are not available in your environment. To build an accurate document layout the fonts are required. If Aspose.Words cannot find the fonts used in the document the fonts are substituted . This might lead into the document layout difference due to difference in font metrics.
Please see our documentation to learn where Aspose.Words looks for fonts:
https://docs.aspose.com/words/python-net/specifying-truetype-fonts-location/
@Subhadeep
- Please try using the following code to check what fonts are available in your environment for Aspose.Words:
fs = aw.fonts.FontSettings.default_instance
for fsb in fs.get_fonts_sources() :
print(fsb.type)
for pfi in fsb.get_available_fonts() :
print(pfi.full_font_name)
print("================================================")
- Most likely the replaced text is a revision. Have you tried applying revisions before converting document to PDF:
doc = aw.Document("C:\\Temp\\in.docx")
doc.accept_all_revisions()
doc.save("C:\\Temp\\out.pdf")