# C1.Xaml.Pdf.C1PdfDocument.DrawString

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Xaml_Pdf_C1PdfDocument_DrawString_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString*">DrawString Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Xaml_Pdf_C1PdfDocument_DrawString_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString*"></a>
<h4 id="C1_Xaml_Pdf_C1PdfDocument_DrawString_System_String_C1_Util_Font_System_Windows_Media_Brush_System_Windows_Rect_System_Int32_C1_Util_StringFormat_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString(System.String,C1.Util.Font,System.Windows.Media.Brush,System.Windows.Rect,System.Int32,C1.Util.StringFormat)">DrawString(string, Font, Brush, Rect, int, StringFormat)</h4>
<div class="markdown level1 summary"><p>Draws the specified text string in the specified rectangle with the
specified <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.media.brush">Brush</a> and <span class="xref">C1.Util.Font</span> objects using the
formatting attributes of the specified <span class="xref">C1.Util.StringFormat</span> object.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public int DrawString(string text, Font font, Brush brush, Rect rc, int firstChar, StringFormat sf)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function DrawString(text As String, font As Font, brush As Brush, rc As Rect, firstChar As Integer, sf As StringFormat) As Integer</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 draw.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Font</span></td>
      <td><span class="parametername">font</span></td>
      <td><p><span class="xref">C1.Util.Font</span> object that defines the appearance and size of the drawn text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.media.brush">Brush</a></td>
      <td><span class="parametername">brush</span></td>
      <td><p><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.media.brush">Brush</a> object that defines the color of the drawn text.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Rect</span></td>
      <td><span class="parametername">rc</span></td>
      <td><p>The rectangle structure that specifies the location of the drawn text, in points from the top left corner of the page.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">firstChar</span></td>
      <td><p>Index of the first character that will be rendered.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">StringFormat</span></td>
      <td><span class="parametername">sf</span></td>
      <td><p><span class="xref">C1.Util.StringFormat</span> object that specifies formatting attributes applied to the drawn text.</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.int32">int</a></td>
      <td></td>
    </tr>
  </tbody>
</table>


<a id="C1_Xaml_Pdf_C1PdfDocument_DrawString_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString*"></a>
<h4 id="C1_Xaml_Pdf_C1PdfDocument_DrawString_System_String_C1_Util_Font_System_Windows_Media_Color_System_Windows_Rect_System_Int32_C1_Util_StringFormat_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString(System.String,C1.Util.Font,System.Windows.Media.Color,System.Windows.Rect,System.Int32,C1.Util.StringFormat)">DrawString(string, Font, Color, Rect, int, StringFormat)</h4>
<div class="markdown level1 summary"><p>Draws the specified text string in the specified rectangle with the
specified <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.media.brush">Brush</a> and <span class="xref">C1.Util.Font</span> objects using the
formatting attributes of the specified <span class="xref">C1.Util.StringFormat</span> object.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public int DrawString(string text, Font font, Color color, Rect rc, int firstChar, StringFormat sf)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function DrawString(text As String, font As Font, color As Color, rc As Rect, firstChar As Integer, sf As StringFormat) As Integer</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 draw.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Font</span></td>
      <td><span class="parametername">font</span></td>
      <td><p><span class="xref">C1.Util.Font</span> object that defines the appearance and size of the drawn text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.media.color">Color</a></td>
      <td><span class="parametername">color</span></td>
      <td><p>The color of the drawn text.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Rect</span></td>
      <td><span class="parametername">rc</span></td>
      <td><p>The rectangle structure that specifies the location of the drawn text, in points from the top left corner of the page.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">firstChar</span></td>
      <td><p>Index of the first character that will be rendered.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">StringFormat</span></td>
      <td><span class="parametername">sf</span></td>
      <td><p><span class="xref">C1.Util.StringFormat</span> object that specifies formatting attributes applied to the drawn text.</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.int32">int</a></td>
      <td><p>The index of first character that was not printed because it did not fit in the specified rectangle.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Xaml_Pdf_C1PdfDocument_DrawString_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString*"></a>
<h4 id="C1_Xaml_Pdf_C1PdfDocument_DrawString_System_String_C1_Util_Font_System_Windows_Media_Brush_System_Windows_Rect_System_Int32_C1_Util_StringFormat_System_Single_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString(System.String,C1.Util.Font,System.Windows.Media.Brush,System.Windows.Rect,System.Int32,C1.Util.StringFormat,System.Single)">DrawString(string, Font, Brush, Rect, int, StringFormat, float)</h4>
<div class="markdown level1 summary"><p>Draws the specified text string in the specified rectangle,
with the specified <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.media.brush">Brush</a> and <span class="xref">C1.Util.Font</span>,
using the formatting attributes of the specified <span class="xref">C1.Util.StringFormat</span> object
and specified character width coefficient.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public int DrawString(string text, Font font, Brush brush, Rect rc, int firstChar, StringFormat sf, float widthCoeff)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function DrawString(text As String, font As Font, brush As Brush, rc As Rect, firstChar As Integer, sf As StringFormat, widthCoeff As Single) As Integer</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>The string to draw.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Font</span></td>
      <td><span class="parametername">font</span></td>
      <td><p>The <span class="xref">C1.Util.Font</span> used to draw the text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.media.brush">Brush</a></td>
      <td><span class="parametername">brush</span></td>
      <td><p>The <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.media.brush">Brush</a> specifying the text color.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Rect</span></td>
      <td><span class="parametername">rc</span></td>
      <td><p>The rectangle specifying the location of the text, in points from the top left corner of the page.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">firstChar</span></td>
      <td><p>The index of the first character that will be rendered.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">StringFormat</span></td>
      <td><span class="parametername">sf</span></td>
      <td><p>The <span class="xref">C1.Util.StringFormat</span> object specifying the formatting attributes applied to 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">widthCoeff</span></td>
      <td><p>The width coefficient applied to characters. The default is 1.0, use 2.0 for double width and so on.</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.int32">int</a></td>
      <td><p>The index of the first character that was not rendered because it did not fit in the specified rectangle.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Xaml_Pdf_C1PdfDocument_DrawString_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString*"></a>
<h4 id="C1_Xaml_Pdf_C1PdfDocument_DrawString_System_String_C1_Util_Font_System_Windows_Media_Color_System_Windows_Rect_System_Int32_C1_Util_StringFormat_System_Single_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString(System.String,C1.Util.Font,System.Windows.Media.Color,System.Windows.Rect,System.Int32,C1.Util.StringFormat,System.Single)">DrawString(string, Font, Color, Rect, int, StringFormat, float)</h4>
<div class="markdown level1 summary"><p>Draws the specified text string in the specified rectangle,
with the specified <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.media.brush">Brush</a> and <span class="xref">C1.Util.Font</span>,
using the formatting attributes of the specified <span class="xref">C1.Util.StringFormat</span> object
and specified character width coefficient.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public int DrawString(string text, Font font, Color color, Rect rc, int firstChar, StringFormat sf, float widthCoeff)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function DrawString(text As String, font As Font, color As Color, rc As Rect, firstChar As Integer, sf As StringFormat, widthCoeff As Single) As Integer</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>The string to draw.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Font</span></td>
      <td><span class="parametername">font</span></td>
      <td><p>The <span class="xref">C1.Util.Font</span> used to draw the text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.media.color">Color</a></td>
      <td><span class="parametername">color</span></td>
      <td><p>The text color.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Rect</span></td>
      <td><span class="parametername">rc</span></td>
      <td><p>The rectangle specifying the location of the text, in points from the top left corner of the page.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">firstChar</span></td>
      <td><p>The index of the first character that will be rendered.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">StringFormat</span></td>
      <td><span class="parametername">sf</span></td>
      <td><p>The <span class="xref">C1.Util.StringFormat</span> object specifying the formatting attributes applied to 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">widthCoeff</span></td>
      <td><p>The width coefficient applied to characters. The default is 1.0, use 2.0 for double width and so on.</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.int32">int</a></td>
      <td><p>The index of the first character that was not rendered because it did not fit in the specified rectangle.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Xaml_Pdf_C1PdfDocument_DrawString_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString*"></a>
<h4 id="C1_Xaml_Pdf_C1PdfDocument_DrawString_System_Windows_Controls_TextBlock_System_Windows_Rect_" data-uid="C1.Xaml.Pdf.C1PdfDocument.DrawString(System.Windows.Controls.TextBlock,System.Windows.Rect)">DrawString(TextBlock, Rect)</h4>
<div class="markdown level1 summary"><p>Draws a string into the specified <span class="xref">System.Windows.Rect</span>.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawString(TextBlock tb, Rect rc)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawString(tb As TextBlock, rc As Rect)</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.windows.controls.textblock">TextBlock</a></td>
      <td><span class="parametername">tb</span></td>
      <td><p><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.windows.controls.textblock">TextBlock</a> that contains the text and formatting options.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">Rect</span></td>
      <td><span class="parametername">rc</span></td>
      <td><p><span class="xref">System.Windows.Rect</span> that specifies the size and position of the text, in points.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
