Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

PdfGraphics.MeasureString(String, DXFont, SizeF) Method

Measures the specified string when drawn with the specified font settings.

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
)

#Parameters

Name Type Description
text String

A text to measure.

font DXFont

An object that contains font parameters.

layoutSize SizeF

The maximum layout area for the text.

#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.

The MeasureString method overload measures a string with 96 DPI. Use the PdfGraphics.MeasureString(String, DXFont, SizeF, PdfStringFormat, Single, Single) method overload to obtain text size with 72 DPI to calculate its size on a PDF page.

See Also