Doc MeasureText Function. Measure the length of a block of text without adding it to the page. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

Measure the length of a block of text without adding it to the page.

 

   
Syntax  

[C#]
double MeasureText(string text)
double MeasureText(string text, double fontSize, double charSpacing, double wordSpacing, bool italic, bool bold, double outline)
double MeasureText(string text, double fontSize, double charSpacing, double wordSpacing, bool italic, bool bold, double outline, int defaultSize1000ths)

[Visual Basic]
Function MeasureText(text As String) As Double
Function MeasureText(text As String, fontSize As Double, charSpacing As Double, wordSpacing As Double, italic As Boolean, bold As Boolean, outline As Double) As Double
Function MeasureText(text As String, fontSize As Double, charSpacing As Double, wordSpacing As Double, italic As Boolean, bold As Boolean, outline As Double, defaultSize1000ths As Integer) As Double

 

   

Params
 
Name Description
text The text to be measured.
fontSize The size of the font.
charSpacing The spacing to be applied between each character.
wordSpacing The spacing to be applied between each word.
italic Whether a synthetic italic style is to be applied.
bold Whether a synthetic bold style is to be applied.
outline The size of any outline to be applied to the font.
defaultSize1000ths The default width for missing characters in 1000ths of an M.
return The width of the text in the units procided.

 

   

Notes
 

This function is used to measure the length of a block of text using the current Font.

This method is unit agnostic so you can use whatever units you like and the result will be returned in terms of those units. However typically you would provide point based measurements to provide a point based length.

 

   

Example
 

None.