Page 1 of 1

Bold text using PdfGraphics DrawString?

Posted: Tue Jan 05, 2016 7:55 pm
by jhaacke
I'm trying to figure out how to draw bolded text using PdfGraphic's DrawString method. It looks like there is a single overload that allows you to pass in a PdfPen, and the PdfPen has a "Width" property that would probably due the trick. However, all the other overloads use PdfBrush and I need to use one of those overloads. Is there a way to draw bolded text using DrawString with a PdfBrush?

Re: Bold text using PdfGraphics DrawString?

Posted: Wed Jan 06, 2016 10:03 am
by Alex
Hello,

Pen is used for drawing lines or curves. Brush is used for filling contours. Font is used for adjustment of text parameters.

You need create bold font if you want to use bold text.

Best regards, Alexander

Re: Bold text using PdfGraphics DrawString?

Posted: Wed Jan 06, 2016 11:36 pm
by jhaacke
Thank you for the response. I'm not sure how to create a bold font with PdfFont. To create a PdfFont, I am currently doing this:

var font = document.FontManager.CreateCIDFontFromTrueTypeFont( PdfFontManager.GetSystemTrueTypeFontFileName( fontName ) )

It doesn't seem like there is any opportunity to specify font style such as Bold when creating the font.

With .Net's System.Drawing.Font class, it's easy because FontStyle is included in an overload of the constructor. But PdfFont doesn't seem to provide this.

Re: Bold text using PdfGraphics DrawString?

Posted: Thu Jan 07, 2016 2:28 pm
by Alex
Hello,

You can create TrueType font, for example Arial Bold font, using the PdfFontManager class:
http://www.vintasoft.com/docs/vsimaging ... nager.html

Best regards, Alexander