Frequently Asked Question:
Problems setting text size when using DrawText
I am using the DrawText function. I need the font size to be smaller but what I'm doing is not working:
Call PDFLibrary.SetPageSize("Letter Landscape")
Call PDFLibrary.AddStandardFont(0)
PDFLibrary.SelectFont (1)
PDFLibrary.SetTextSize (10)
Please advise!
I've included some C# sample code below that will probably help you understand better how the DrawText, AddStandardFont, SelectFont and SetTextSize functions work together. In this example we're going to draw a string of text for each of the standard fonts and with each string of text we draw, we're going to increase the font size. Like this:
QP.SetPageSize("Letter Landscape");
int FontSize = 10;
int XPos = 10;
int YPos = 600;
for (int i = 0; i <= 13; i++)
{
QP.AddStandardFont(i);
QP.SelectFont(1);
string FontName = QP.FontName();
QP.SetTextSize(FontSize);
QP.DrawText(XPos, YPos, FontName + " Font With Size " + Convert.ToString(FontSize));
FontSize += 2;
YPos -= 40;
}
QP.SaveToFile("C:\\MyPdf.pdf");