Method GetTextWidth
- Namespace
- BitMiracle.Docotic.Pdf
- Assembly
- BitMiracle.Docotic.Pdf.dll
GetTextWidth(string)
Gets the width of the specified string in default user space units when drawn with current Font.
public double GetTextWidth(string text)
Parameters
text
stringThe string to measure.
Returns
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
text
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.- CannotShowTextException
text
contains a glyph that cannot be drawn using the current Font.
GetTextWidth(string, PdfMissingGlyphMapper?)
Gets the width of the specified string in default user space units when drawn with current Font.
public double GetTextWidth(string text, PdfMissingGlyphMapper? missingGlyphHandler)
Parameters
text
stringThe string to measure.
missingGlyphHandler
PdfMissingGlyphMapperThe handler for glyphs that cannot be drawn using the current Font.
Returns
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
text
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.- CannotShowTextException
text
contains a glyph that cannot be drawn using the current Font and cannot be substituted using themissingGlyphHandler
.