Bold text using PdfGraphics DrawString?

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
jhaacke
Posts: 2
Joined: Tue Jan 05, 2016 7:47 pm

Bold text using PdfGraphics DrawString?

Post by jhaacke » Tue Jan 05, 2016 7:55 pm

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?

Alex
Site Admin
Posts: 1474
Joined: Thu Jul 10, 2008 2:21 pm

Re: Bold text using PdfGraphics DrawString?

Post by Alex » Wed Jan 06, 2016 10:03 am

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

jhaacke
Posts: 2
Joined: Tue Jan 05, 2016 7:47 pm

Re: Bold text using PdfGraphics DrawString?

Post by jhaacke » Wed Jan 06, 2016 11:36 pm

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.

Alex
Site Admin
Posts: 1474
Joined: Thu Jul 10, 2008 2:21 pm

Re: Bold text using PdfGraphics DrawString?

Post by Alex » Thu Jan 07, 2016 2:28 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest