Hi Paul,
Thanks for your feedback. Please check following code snippet to reference a true type font from folder path. Hopefully it will serve the purpose. If issue persist then please share your sample html document and font file. So we will test the scenario at our end and will provide you more information.
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
// Read the contents of HTML file into StreamReader object
StreamReader r = File.OpenText(myDir + “HtmlFont.html”);
//Create text paragraphs containing HTML text
Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());
// enable the property to display HTML contents within their own formatting
text2.IsHtmlTagSupported = true;
text2.TextInfo.IsUnicode = true;
// to use custom true type font
text2.TextInfo.TruetypeFontFileName = “D:/OmnesBold-Roman.ttf”;
text2.TextInfo.FontName = “OmnesBold-Roman”;
//<-- without this line FontName property does not influence HtmlToPdf conversion
text2.UseTextInfoStyle = true;
//Add the text paragraphs containing HTML text to the section
section.Paragraphs.Add(text2);
section.IsLandscape = true;
//Save the pdf document
pdf.SetUnicode();
pdf.Save(myDir + “HtmlPDF.pdf”);
Please feel free to contact us for any further assistance.
Best Regards,