PdfCanvas.MeasureText Method (String, PdfMissingGlyphMapper)

Measures the specified string when drawn with current Font.

Namespace:  BitMiracle.Docotic.Pdf
Assembly:  BitMiracle.Docotic.Pdf (in BitMiracle.Docotic.Pdf.dll)

Syntax

C#
public PdfSize MeasureText(
	string text,
	PdfMissingGlyphMapper missingGlyphHandler
)
VB
Public Function MeasureText ( 
	text As String,
	missingGlyphHandler As PdfMissingGlyphMapper
) As PdfSize

Parameters

text
Type: System.String
The string to measure.
missingGlyphHandler
Type: BitMiracle.Docotic.Pdf.PdfMissingGlyphMapper
The handler for glyphs that cannot be drawn using the current Font.

Return Value

Type: PdfSize
A PdfSize structure that represents the size, in default user space units, of the string specified by the text parameter as drawn with the current Font.

Exceptions

ExceptionCondition
ArgumentExceptiontext contains an invalid surrogate pair. Either the first character in the pair is not a valid high surrogate or the second character in the pair is not a valid low surrogate.
CannotShowTextExceptiontext contains a glyph that cannot be drawn using the current Font and cannot be substituted using the missingGlyphHandler.

Remarks

By default, user space unit is 1/72 inch. When this canvas is taken from PdfPage, user space unit depends on the UserUnit property.

See Also