Aspose.PDF converting font to alternate font

I am using the Aspose.PDF v19.8.0 library to convert a .docx file to a PDF and the conversion is replacing one of the fonts in the .docx file with an alternate font. I tried upgrading to the latest version, 21.1.0 on a trial basis just to see if the issue would be resolved, but the font is still being replaced.

The font is a TrueType font named TV NordEF and it is being replaced with the alternate Franklin Gothic Medium Cond. I took the same .docx file and printed it using the built in Windows 10 PDF generator and third party tools such as SumatraPDF and CutePDF and each of those applications was able to successfully print the .docx as a PDF and maintained the correct font, TV NordEF.

I have confirmed that the desired font is installed on my development machine and have confirmed that the code I am using will correctly embed the fonts as a subset:

PdfSaveOptions saveOptions = new PdfSaveOptions
        {
            EmbedFullFonts = false,
            FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll
        };

I have tested the above font embedding code with multiple free TrueType fonts and all were embedded correctly on PDF generation. I am trying to confirm if there is a potential code/library issue or if there is a problem with the font in regards to the Aspose library.

Thank you

@jrubright

Aspose.PDF offers the functionality to convert a PDF document to .doc/.docx. Aspose.Words serves the purpose to convert a .docx to PDF. Would you please confirm if you are using Aspose.PDF or Aspose.Words to carry out the functionality? Also, please share your sample source file and complete code snippet along with sample output document with issues. We will test the scenario in our environment and address it accordingly.

I am using the Aspose.PDF library to convert the docx file to PDF.

Here is the code that I am using, a very simple command line program to try and isolate the test case(s) and for ease of swapping between libraries:

        // Load license files above this line

        string docPath = @"path_to_docx_file_without_extension";

        Aspose.Words.Document doc = new Aspose.Words.Document(docPath + ".docx");

        PdfSaveOptions saveOptions = new PdfSaveOptions
        {
            EmbedFullFonts = false,
            FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll
        };

        doc.Save(docPath + ".pdf", saveOptions);

Sample file is attached.
Sample_Doc.zip (9.4 KB)

@jrubright

You are using Aspose.Words to carry out the DOCX to PDF conversion. We are moving your inquiry to Aspose.Words forum category where you will be assisted accordingly.

@jrubright,

Please also ZIP and attach the following font file here for further testing on our end:

  • TV NordEF Regular

Does Aspose.Words for .NET throw any warning messages during this Word DOCX document to PDF conversion on your end? Please check: How to Recognize That the Font Was Replaced?

Please also provide MS Word and Aspose.Words generated PDF files here for our reference.

As soon as you get these pieces of information ready, we will start further investigation into your issue and provide you more information.

There are no warnings or errors thrown in the small command line program I wrote, the conversion happens without any problems.

I am attaching the Word Document and the PDF that was generated from the Word Document. Unfortunately, I cannot post the font directly to this forum as it was a purchased font family and both myself and my company are not comfortable making it available for others to download directly. If there is another mechanism to get the font to the engineering/support team I would be more than happy doing that.

Thanks

Sample_Docs.zip (24.9 KB)

@jrubright,

The PDF file “Sample_Doc.pdf” that you shared was actually produced by using 19.8 version of Aspose.Words for .NET. Please also use the “Save As” command of MS Word and share the MS Word generated PDF file here for our reference.

Regarding sharing the Font file, please note that it is safe to attach files in the forum. If you attach your documents/resources here, then only you and Aspose staff members can download them. You can also post the ZIP file ‘via private message’. In order to send a private message with attachment, please click on my name and find “Message” button.

Sharing Data with Aspose – Data Security

Attached are the MS Word generated PDF as well as the TV NordEF Regular font.

Thanks again.

PDF_And_Font.zip (106.8 KB)

@jrubright,

I have installed the following font files on my machine.

  • TV NordEF Regular
  • Franklin Gothic Medium Cond

And then after an initial test with the licensed latest (21.1) version of Aspose.Words for .NET, I was unable to reproduce this issue on my end. Please see the following output PDF documents generated on my end:

C# code used to produce above files:

Document doc = new Document("C:\\Temp\\PDF_And_Font\\input.docx");
doc.Save("C:\\Temp\\PDF_And_Font\\output.pdf");

So, we suggest you to please upgrade to the latest version of Aspose.Words and make sure that the above fonts are installed on your machine.