Does Aspose.PDF follow OpenType or TrueType specification

Hi,

We want to use “Arial Unicode MS” while convert html to pdf using Aspose.PDF. And we want to embed the font into pdf.
Does Aspose.PDF follow the rules and restrictions defined in the OpenType or TrueType specification? Can we use “Arial Unicode MS” in pdf file and embed font into pdf? Do you have suggestion for us?

@lucy.hq

You can achieve your requirements by using the below sample code snippet:

// Instantiate Document object
Document docc = new Document();
// Add a page to pages collection of PDF file
Page page = docc.getPages().add();
// Instantiate HtmlFragment with HTML contnets
HtmlFragment title = new HtmlFragment("<p style='font-family: Verdana'><b><i>Table contains text</i></b></p>");
//Font-family from 'Verdana' will be reset to 'Arial'
title.setTextState(new TextState("ArialUnicodeMS"));
title.getTextState().setFontSize(20);
title.getTextState().getFont().setEmbedded(true);
page.getParagraphs().add(title);
// Save PDF file
dataDir = dataDir + "AddHTMLUsingDOMAndOverwrite_out.pdf";
// Save PDF file
doc.save(dataDir);

Can you please explain a bit more about above question by sharing some rules list or online link reference? We will share our feedback with you accordingly.

Hello,
I think the reason of the question is the following restriction from Microsoft:
When can I use document embedding?
The brief answer: If an application follows the rules and restrictions defined in the OpenType or TrueType specification, you can use it to embed Windows supplied fonts in any document file it creates. For example, Microsoft Word and PowerPoint follow the rules and restrictions, so you can use these applications to create documents (such as Word documents, PowerPoint decks and PDFs) that include embedded fonts.
Font redistribution FAQ - Typography | Microsoft Learn
I’m interested in this topic as well. Also if Aspose.words follow those specification when converting word documents to pdf
Thank you very much.

@FK1

PDF file format is different than Microsoft Office products and Fonts embedding rules may also be different for Aspose.PDF API. However, an investigation ticket as PDFNET-57359 has been logged in our issue tracking system to further analyze this scenario. We will gather all related information and as soon as the ticket is resolved, we will update you via this forum thread. Please spare us some time.

1 Like