Fonts of PDF document are Changed | DOCX to PDF Conversion using Java

We tried in a variety of input files with the fonts installed on the system and then rendered the document to pdf.
Much to our surprise, the fonts in the pdf rendition are different from the original fonts.
The same thing works when we use office to save_as the word document and we can see the exact fonts.

Word 2013 Document.zip (67.2 KB)

This is reproducible on a lot of input files.

Regards,
Ankur Vashishtha

@rnara

We have not found any issue with shared input and output documents. Could you please share some more detail about your issue and requirement?

Did you check the fonts of the rendered PDF?
Can you please share the rendered PDF here.

Regards,
Ankur Vashishtha

@rnara

We have attached the screenshot of PDF file and output PDF files with this post for your kind reference.
PDF output.png (429.6 KB)
Word 2003 Document.doc 21.8.pdf (37.7 KB)
Word 2013 Document.docx 21.8.pdf (25.8 KB)

If you want to embed fonts into PDF file, please use the following code example.

var document = new Document(MyDir + "Word 2013 Document.docx");

PdfSaveOptions options = new PdfSaveOptions();
options.EmbedFullFonts = true;
options.FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll;

document.Save(MyDir + "21.9.pdf", options);

Thanks a lot for the quick update. Let me check this and revert back.

Regards,
Ankur Vashishtha

I think the above code is for .net
Anyway I used this for Java
PdfSaveOptions options= new PdfSaveOptions();
options.setEmbedFullFonts(true);
options.setFontEmbeddingMode(0);

Can you please point me to dev references to understand the options available in setFontEmbeddingMode and setEmbedFullFonts to understand the impact on size , correctness and speed of rendering the pdf.

Regards,
Ankur Vashishtha

@rnara

Please note that some fonts are large (several megabytes) and embedding them without subsetting will result in large output documents. We suggest you please read the detail of these methods from here: