Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

how to set bold font

Question

I'm using DrawText . I need the text to be Bold while printing .

   SetFontFlags(0, 0, 0, 0, 0,  0, 0, 1); has no effeect
   applyStyle('Bold');       has no effeect

The only thing that helps is calling DrawText twice but it makes the font bold on screen only and in the printed version it looks regular

Answer

The SetFontFlags function is for advanced use only and in this case won't help you set a bold font in the fashion that you want it to.

If you want to draw some bold text onto a PDF then before you call the DrawText function you need to add a bold font to your document (e.g. Arial Bold). Here is an example of how to add bold text to a document:

// Use the AddTrueTypeFont function to add a bold font to
// the default blank document and get the return
// value which is the font ID.

fontID1 = QP.AddTrueTypeFont("Arial Rounded MT Bold", 1);

// Select the font using its font ID

QP.SelectFont(fontID1);

// Draw some text onto the document to see if
// everything is working OK.

QP.DrawText(100, 700, "Arial Rounded MT Bold");

Arial Regular and Arial Bold are different fonts, so if you want to write regular Arial text and then write bold Arial text, then you need to add two different fonts to the document.


© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum