PdfGraphics.MeasureString(String, DXFont, PdfStringFormat, Single, Single) Method
Measures the specified string when drawn with the specified font and format parameters, horizontal and vertical resolutions.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v24.2.Drawing.dll
NuGet Package: DevExpress.Pdf.Drawing
#Declaration
public SizeF MeasureString(
string text,
DXFont font,
PdfStringFormat format,
float dpiX,
float dpiY
)
#Parameters
Name | Type | Description |
---|---|---|
text | String | A text to measure. |
font | DXFont | An object that defines font settings. |
format | Pdf |
An object that specifies text formatting parameters. |
dpi |
Single | The horizontal resolution, in dots per inch. The default value is 96. |
dpi |
Single | The vertical resolution, in dots per inch. The default value is 96. |
#Returns
Type | Description |
---|---|
Size |
The string’s measured size. |
#Remarks
Use this method to calculate the size of the drawn text. Use the returned SizeF object to calculate a page area or a point where you can draw text.
#Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the MeasureString(String, DXFont, PdfStringFormat, Single, Single) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.