Skip to main content

PdfGraphics.MeasureString(String, Font, SizeF, PdfStringFormat, Single, Single) Method

Measures the specified string when drawn with specified font and text formatting parameters. Allows you to specify text layout size, and horizontal and vertical resolutions.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v23.2.Drawing.dll

NuGet Package: DevExpress.Pdf.Drawing

Declaration

public SizeF MeasureString(
    string text,
    Font font,
    SizeF layoutSize,
    PdfStringFormat format,
    float dpiX,
    float dpiY
)

Parameters

Name Type Description
text String

A text to measure.

font Font

An object that defines font parameters.

layoutSize SizeF

The maximum layout area for the text.

format PdfStringFormat

An object that defines text formatting parameters.

dpiX Single

The horizontal resolution, in dots per inch. The default value is 96.

dpiY Single

The vertical resolution, in dots per inch. The default value is 96.

Returns

Type Description
SizeF

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.

See Also