# C1.Pdf.C1PdfDocument.MeasureStringHtml

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Pdf_C1PdfDocument_MeasureStringHtml_" data-uid="C1.Pdf.C1PdfDocument.MeasureStringHtml*">MeasureStringHtml Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Pdf_C1PdfDocument_MeasureStringHtml_" data-uid="C1.Pdf.C1PdfDocument.MeasureStringHtml*"></a>
<h4 id="C1_Pdf_C1PdfDocument_MeasureStringHtml_System_String_C1_Util_Font_System_Single_" data-uid="C1.Pdf.C1PdfDocument.MeasureStringHtml(System.String,C1.Util.Font,System.Single)">MeasureStringHtml(string, Font, float)</h4>
<div class="markdown level1 summary"><p>Measures a HTML string when drawn with a given <a class="xref" href="C1.Util.Font.html">Font</a> object
into a rectangle with the specified width.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public SizeF MeasureStringHtml(string text, Font font, float width = -1)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function MeasureStringHtml(text As String, font As Font, Optional width As Single = -1) As SizeF</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">text</span></td>
      <td><p>String to measure.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.Font.html">Font</a></td>
      <td><span class="parametername">font</span></td>
      <td><p><a class="xref" href="C1.Util.Font.html">Font</a> object that defines the appearance and size of the text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">width</span></td>
      <td><p>Maximum width of the string.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.sizef">SizeF</a></td>
      <td><p>The size of the string expressed in points.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="implements">Implements</h5>
    <div><a class="xref" href="C1.Util.IFlowDocument.MeasureStringHtml.html#C1_Util_IFlowDocument_MeasureStringHtml_System_String_C1_Util_Font_System_Single_">IFlowDocument.MeasureStringHtml(string, Font, float)</a></div>
<h5 id="C1_Pdf_C1PdfDocument_MeasureStringHtml_System_String_C1_Util_Font_System_Single__remarks">Remarks</h5>
<div class="markdown level1 remarks"><pre><code>&lt;p&gt;This method is similar to &lt;xref href=&quot;C1.Pdf.C1PdfDocument.MeasureString(System.String%2cC1.Util.Font%2cSystem.Single)&quot; data-throw-if-not-resolved=&quot;false&quot;&gt;&lt;/xref&gt;, except the
</code></pre>
<p><code class="paramref">text</code> parameter contains an HTML string instead of plain text.</p>
<p>For details, see the <a class="xref" href="C1.Pdf.C1PdfDocument.DrawStringHtml.html#C1_Pdf_C1PdfDocument_DrawStringHtml_System_String_C1_Util_Font_System_Drawing_Color_System_Drawing_RectangleF_System_Single_">DrawStringHtml(string, Font, Color, RectangleF, float)</a> method.</p>
</div>
</div>
