Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Feb 28, 2017 11:43 am

I'm using custom private fonts for text i a pdf.

In the text, I need to add bold formatting, using a secondary font:
Code: Select all
String fontFileName = "DeeDeeFlowers.ttf";
PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(fontFileName, 20f);


I've set htmlTags to true, and output the content as:
Code: Select all
newPage.Canvas.DrawString("Test string with <b>bold</b> type", trueTypeFont, new PdfSolidBrush(Color.Black), 10, 10, true);


All text displays fine with custom font, except the <b> section, which uses some system font.

I have other ttf font files for italic and bold fonts, so question is, can I somehow create a custom font-family to use?

RNR GFX
 
Posts: 3
Joined: Thu Jan 05, 2017 12:14 pm

Wed Mar 01, 2017 3:12 am

Dear RNR GFX,

Thanks for your inquiry.
Sorry that I am afraid the embedded font way doesn't support that HTML tag.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF