# C1.Win.FlexGrid.PrintDocumentGridRenderer

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="C1_Win_FlexGrid_PrintDocumentGridRenderer" data-uid="C1.Win.FlexGrid.PrintDocumentGridRenderer" class="text-break">PrintDocumentGridRenderer Class
</h1>
  <div class="markdown level0 summary"><p>Represents an object that renders a <a class="xref" href="C1.Win.FlexGrid.C1FlexGrid.html">C1FlexGrid</a> into a
paged <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.printing.printdocument">PrintDocument</a>.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><span class="xref">PrintDocumentGridRenderer</span></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="C1.Win.FlexGrid.html">C1.Win.FlexGrid</a></h6>
  <h6><strong>Assembly</strong>: C1.Win.FlexGrid.10.dll</h6>
  <h5 id="C1_Win_FlexGrid_PrintDocumentGridRenderer_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class PrintDocumentGridRenderer</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class PrintDocumentGridRenderer</code></pre>
  </div>
  <h5 id="C1_Win_FlexGrid_PrintDocumentGridRenderer_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>This class may be used to print multiple grids, along with other 
custom content, into an existing <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.printing.printdocument">PrintDocument</a> object.</p>
<p>To use it, create one <b>PrintDocumentGridRenderer</b> for each
grid you want to print. Then handle the document events and call the
<a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.PrintPage.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_PrintPage_System_Drawing_Printing_PrintPageEventArgs_System_Boolean_">PrintPage(PrintPageEventArgs, bool)</a> event for the renderers until the value of the
<a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.CurrentPage.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_CurrentPage">CurrentPage</a> property equals <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.PageCount.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_PageCount">PageCount</a>.</p>
<example>
The code below renders two grids into a <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.printing.printdocument">PrintDocument</a>:
<pre><code class="lang-csharp">// print two grids into an existing PrintDocument
private void button1_Click(object sender, EventArgs e)
{
  using (var dlg = new PrintPreviewDialog())
  {
    dlg.Document = this.printDocument1;
    dlg.ShowDialog(this);
  }
}
<p>// event handlers for the PrintDocument object on the form
PrintDocumentGridRenderer _g1, _g2;
void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
// create and configure grid renderer for the first grid
_g1 = new PrintDocumentGridRenderer(c1FlexGrid1);
_g1.Options = PrintGridFlags.FitToPageWidth | PrintGridFlags.ExtendLastCol;</p>
<p>// create and configure grid renderer for the second grid
_g2 = new PrintDocumentGridRenderer(c1FlexGrid2);
_g2.Options = PrintGridFlags.FitToPageWidth | PrintGridFlags.ExtendLastCol;
}
void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
// render first grid
if (_g1.CurrentPage &lt; _g1.PageCount)
{
_g1.PrintPage(e);
e.HasMorePages = true;
}</p>
<p>// render second grid
else if (_g2.CurrentPage &lt; _g2.PageCount)
{
_g2.PrintPage(e);
e.HasMorePages = _g2.CurrentPage &lt; _g2.PageCount;
}
}</p></code></pre>
</example>
</div>
  <h3 id="constructors">Constructors
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Win_FlexGrid_PrintDocumentGridRenderer__ctor_C1_Win_FlexGrid_C1FlexGridBase_" data-uid="C1.Win.FlexGrid.PrintDocumentGridRenderer.#ctor(C1.Win.FlexGrid.C1FlexGridBase)">
          <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.-ctor.html#C1_Win_FlexGrid_PrintDocumentGridRenderer__ctor_C1_Win_FlexGrid_C1FlexGridBase_">PrintDocumentGridRenderer(C1FlexGridBase)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of a <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.html">PrintDocumentGridRenderer</a>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Win_FlexGrid_PrintDocumentGridRenderer_CurrentPage" data-uid="C1.Win.FlexGrid.PrintDocumentGridRenderer.CurrentPage">
          <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.CurrentPage.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_CurrentPage">CurrentPage</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the index of the page being rendered.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_FlexGrid_PrintDocumentGridRenderer_FirstPageY" data-uid="C1.Win.FlexGrid.PrintDocumentGridRenderer.FirstPageY">
          <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.FirstPageY.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_FirstPageY">FirstPageY</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the Y coordinate of the first block of cells rendered on
the document.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_FlexGrid_PrintDocumentGridRenderer_Options" data-uid="C1.Win.FlexGrid.PrintDocumentGridRenderer.Options">
          <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.Options.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_Options">Options</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the flags that specify printing options to use with the <a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.PrintGrid.html#C1_Win_FlexGrid_C1FlexGridBase_PrintGrid_System_String_C1_Win_FlexGrid_PrintGridFlags_">PrintGrid(string, PrintGridFlags)</a>
method. See the <a class="xref" href="C1.Win.FlexGrid.PrintGridFlags.html">PrintGridFlags</a> enumeration for details.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_FlexGrid_PrintDocumentGridRenderer_PageCount" data-uid="C1.Win.FlexGrid.PrintDocumentGridRenderer.PageCount">
          <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.PageCount.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_PageCount">PageCount</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the total number of pages in the document.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_FlexGrid_PrintDocumentGridRenderer_PageOrder" data-uid="C1.Win.FlexGrid.PrintDocumentGridRenderer.PageOrder">
          <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.PageOrder.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_PageOrder">PageOrder</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the order of the pages when the data does not fit on one page.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Win_FlexGrid_PrintDocumentGridRenderer_PrintPage_System_Drawing_Printing_PrintPageEventArgs_System_Boolean_" data-uid="C1.Win.FlexGrid.PrintDocumentGridRenderer.PrintPage(System.Drawing.Printing.PrintPageEventArgs,System.Boolean)">
          <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.PrintPage.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_PrintPage_System_Drawing_Printing_PrintPageEventArgs_System_Boolean_">PrintPage(PrintPageEventArgs, bool)</a>
        </td>
        <td class="markdown level1 summary"><p>Renders the current page into the document.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_FlexGrid_PrintDocumentGridRenderer_PrintPage_System_Drawing_Printing_PrintPageEventArgs_System_Int32_System_Boolean_" data-uid="C1.Win.FlexGrid.PrintDocumentGridRenderer.PrintPage(System.Drawing.Printing.PrintPageEventArgs,System.Int32,System.Boolean)">
          <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.PrintPage.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_PrintPage_System_Drawing_Printing_PrintPageEventArgs_System_Int32_System_Boolean_">PrintPage(PrintPageEventArgs, int, bool)</a>
        </td>
        <td class="markdown level1 summary"><p>Renders a specific page into the document.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_FlexGrid_PrintDocumentGridRenderer_Setup_System_Drawing_Printing_PrintPageEventArgs_" data-uid="C1.Win.FlexGrid.PrintDocumentGridRenderer.Setup(System.Drawing.Printing.PrintPageEventArgs)">
          <a class="xref" href="C1.Win.FlexGrid.PrintDocumentGridRenderer.Setup.html#C1_Win_FlexGrid_PrintDocumentGridRenderer_Setup_System_Drawing_Printing_PrintPageEventArgs_">Setup(PrintPageEventArgs)</a>
        </td>
        <td class="markdown level1 summary"><p>Calculates the zoom factor and page breaks in the document.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
