Method MeasureText
- Namespace
- BitMiracle.Docotic.Pdf
- Assembly
- BitMiracle.Docotic.Pdf.dll
MeasureText(string)
Measures the specified string when drawn with current Font.
public PdfSize MeasureText(string text)
Parameters
textstringThe string to measure.
Returns
- PdfSize
A PdfSize structure that represents the size, in default user space units, of the string specified by the
textparameter as drawn with the current Font.
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.
Exceptions
- ArgumentException
textcontains 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.- CannotShowTextException
textcontains a glyph that cannot be drawn using the current Font.
MeasureText(string, PdfMissingGlyphMapper?)
Measures the specified string when drawn with current Font.
public PdfSize MeasureText(string text, PdfMissingGlyphMapper? missingGlyphHandler)
Parameters
textstringThe string to measure.
missingGlyphHandlerPdfMissingGlyphMapperThe handler for glyphs that cannot be drawn using the current Font.
Returns
- PdfSize
A PdfSize structure that represents the size, in default user space units, of the string specified by the
textparameter as drawn with the current Font.
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.
Exceptions
- ArgumentException
textcontains 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.- CannotShowTextException
textcontains a glyph that cannot be drawn using the current Font and cannot be substituted using themissingGlyphHandler.