PdfGraphics.MeasureString(String, DXFont, SizeF, PdfStringFormat) Method
Measures the specified string when drawn with the specified font, text layout size, and format.
Namespace: DevExpress.Pdf
Assembly: DevExpress.Pdf.v24.2.Drawing.dll
NuGet Package: DevExpress.Pdf.Drawing
#Declaration
public SizeF MeasureString(
string text,
DXFont font,
SizeF layoutSize,
PdfStringFormat format
)
#Parameters
Name | Type | Description |
---|---|---|
text | String | A String to measure. |
font | DXFont | An object that contains font parameters. |
layout |
Size |
Specifies the maximum layout area for the text. |
format | Pdf |
An object that contains text formatting parameters. |
#Returns
Type | Description |
---|---|
Size |
The string’s measured size. |
#Remarks
Use this method to calculate a size of the drawn text. Use the returned SizeF object to calculate a page area or a point where you can draw text.
The MeasureString
method overload measures a string with 96 DPI. Use the PdfGraphics.MeasureString(String, DXFont, PdfStringFormat, Single, Single) method overload to obtain text size with 72 DPI to calculate its size on a PDF page.