Using Aspose.PDF 10.4
Thank goodness for ILSpy. I search through the Aspose.PDF dll for "font" and finally figured it out. Full namespaces below so you know where to get the methods and objects.
//create the font from a ttf file
Aspose.Pdf.Text.Font myFont =
Aspose.Pdf.Text.FontRepository.OpenFont("C:\temp\MyFont-Regular.ttf");
myFont.IsEmbedded = true;
//new doc, add a new blank page
Document doc = new Document();
Page page = doc.Pages.Add();
//use the font in a style
TextState style = new TextState();
style.Font = myFont;
style.FontSize = 12;
style.FontStyle = FontStyles.Regular;
style.LineSpacing = 4;
TextFragment frag = new TextFragment(sb.ToString());
frag.TextState.ApplyChangesFrom(style);
frag.IsInLineParagraph = true;
page.Paragraphs.Add(frag);
//save it
doc.Save("C:\temp\fontTest.pdf");
Hi Dirk,
Thanks for your feedback. It is good to know that you have manged to accomplish your requirements. Please keep using our API and feel free to ask any question or concern, we will be more than happy to extend our support.
Best Regards,