Skip to main content
All docs
V25.1
  • 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.v25.1.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 PdfStringFormat

    An object that specifies 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 the size of the drawn text. Use the returned SizeF object to calculate a page area or a point where you can draw text.

    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.

    See Also