Doc Font Property. The current Font ID. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

 

Type Default Read Only Description
[C#] int

[Visual Basic]
Integer
  0 No The current Font ID.

 

   

Notes
 

The font used for drawing text.

This property holds the current Font ID and determines the style of text that is added to the document using methods like AddText.

To get a Font ID you need to add your font to the current document using the AddFont method.

The Font property is an accessor for the the XTextStyle.Font property.

 

   

Example
 

The following example adds two blocks of styled text to a document. The first block is in Helvetica and the second in Courier.

[C#]
Doc theDoc = new Doc();
theDoc.FontSize = 96; // big text
theDoc.Font = theDoc.AddFont("Helvetica");
theDoc.AddText("Helvetica Text.");
theDoc.Font = theDoc.AddFont("Courier");
theDoc.AddText("Courier Text.");
theDoc.Save(Server.MapPath("docfont.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.FontSize = 96 ' big text
theDoc.Font = theDoc.AddFont("Helvetica")
theDoc.AddText("Helvetica Text.")
theDoc.Font = theDoc.AddFont("Courier")
theDoc.AddText("Courier Text.")
theDoc.Save(Server.MapPath("docfont.pdf"))
theDoc.Clear()


docfont.pdf