Font-Embedding ROMAN

Hello,
we upgraded from version 18.1 to version 24.8. During this transition, we noticed differences in how fonts are embedded when generating a PDF file from a Word document.
Fonts are now embedded twice with different encodings.
Where does this difference come from, and what does it mean?
Is it possible to restore the behavior as it was in version 18.1?

I’ve compared the two files generated by the versions:

18.1                                                                      24.8.1
								
Font                     Type            Encoding          Font                     Type            Encoding
								
ArialMT                 TrueType        Ansi              ArialMT                 TrueType        Ansi
Calibri                 TrueType        Ansi              Calibri                 TrueType        Ansi
HelveticaNeueLTStd-Lt   Type 1          Ansi              HelveticaNeueLTStd-Lt   Type 1          Identity-H
HelveticaNeueLTStd-Lt   Type 1 (CID)    Identity-H        HelveticaNeueLTStd-Lt   Type 1 (CID)    Identity-H
HelveticaNeueLTStd-Lt   Type 1 (CID)    Identity-H        HelveticaNeueLTStd-Lt   Type 1 (CID)    Identity-H
                       			                         HelveticaNeueLTStd-Lt   Type 1          Roman
HelveticaNeueLTStd-Md   Type 1          Ansi              HelveticaNeueLTStd-Md   Type 1          Identity-H
HelveticaNeueLTStd-MD   Type 1 (CID)    Identity-H        HelveticaNeueLTStd-Md   Type 1          Roman
HelveticaNeueLTStd-Th   Type 1          Ansi              HelveticaNeueLTStd-Th   Type 1          Roman
OCRAExtended            TrueType        Ansi              OCRAExtended            TrueType        Ansi
OCRAExtended            TrueType        Ansi              OCRAExtended            TrueType        

@manuel.memenga

Cause

The differences in font embedding between versions 18.1 and 24.8 are due to changes in how Aspose.Words handles font encoding and embedding. In the newer version, certain fonts may be embedded with different encodings, such as “Identity-H” and “Roman,” which can result in the appearance of duplicate font entries in the generated PDF.

Solution

To restore the behavior from version 18.1, you should adjust the font embedding settings in your code. Specifically, set the FontSettings to control how fonts are embedded in the PDF output. Here’s a code snippet to help you implement this:

import com.aspose.words.Document;
import com.aspose.words.FontSettings;
import com.aspose.words.SaveFormat;

public class FontEmbeddingExample {
    public static void main(String[] args) throws Exception {
        // Load your document
        Document doc = new Document("input.docx");

        // Set font settings
        FontSettings fontSettings = new FontSettings();
        fontSettings.setEmbedFullFonts(true); // Ensure full fonts are embedded

        // Save the document as PDF
        doc.save("output.pdf", SaveFormat.PDF);
    }
}

Adjust the FontSettings as needed to meet your specific requirements.

Next Steps

  1. Test the provided code to determine if it resolves the font embedding issue.
  2. If the problem persists, review the release notes for version 24.8 to identify any additional changes related to font handling.
  3. If necessary, contact Aspose support for further assistance regarding specific font embedding behaviors.

Please let me know if you need any further assistance!

@manuel.memenga Could you please attach your input and output documents produced by old and new versions of Aspose.Words along with your fonts and code? We will check the issue on our side and provide you more information.