# GrapeCity.ActiveReports.Viewer.Win.Viewer.Print

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.Print*">Print Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.Print*"></a>
<h4 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_System_Boolean_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.Print(System.Boolean)">Print(bool)</h4>
<div class="markdown level1 summary"><p>Initiates the printing process for the currently opened document, either a section or a page report, with the option to display or bypass the print dialog.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public bool Print(bool showPrintDialog)</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.boolean">bool</a></td>
      <td><span class="parametername">showPrintDialog</span></td>
      <td><p>Specifies whether to display the print dialog before printing.
Setting this to <code>true</code> shows the print dialog, allowing the user to select printer settings.
Setting this to <code>false</code> bypasses the print dialog and uses the default printer settings.</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.boolean">bool</a></td>
      <td><p>Returns <code>true</code> if the printing process is initiated successfully; otherwise, returns <code>false</code>.
Note that a return value of <code>true</code> does not guarantee the completion of the printing process,
but rather the successful initiation of the print job.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_System_Boolean__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This overload of the <code>Print</code> method uses default settings for showing the print progress dialog and using a printing thread.
To customize these settings, consider using the overload that accepts these parameters explicitly.</p>
</div>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_System_Boolean__examples">Examples</h5>
<pre><code class="lang-csharp">// Assuming 'viewer' is an instance of the Viewer class
// This will print to the default printer without showing the print dialog
bool printSuccess = viewer.Print(showPrintDialog: false);
if (printSuccess)
    MessageBox.Show("Printing initiated successfully.");
else
    MessageBox.Show("Printing failed.");</code></pre>



<a id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.Print*"></a>
<h4 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_System_Boolean_System_Boolean_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.Print(System.Boolean,System.Boolean)">Print(bool, bool)</h4>
<div class="markdown level1 summary"><p>Initiates the printing process for the currently opened document, allowing for the display of the print dialog
and the print progress dialog based on the provided parameters.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public bool Print(bool showPrintDialog, bool showPrintProgressDialog)</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.boolean">bool</a></td>
      <td><span class="parametername">showPrintDialog</span></td>
      <td><p>If set to <code>true</code>, the print dialog is displayed, enabling the user to modify
printer settings before printing. If set to <code>false</code>, the document is sent directly to the default printer without displaying the print dialog.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">showPrintProgressDialog</span></td>
      <td><p>If set to <code>true</code>, a print progress dialog is displayed during the printing process,
providing feedback on the print job status. If set to <code>false</code>, the printing process occurs without displaying the progress dialog.</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.boolean">bool</a></td>
      <td><p>Returns <code>true</code> if the printing process is successfully initiated; otherwise, returns <code>false</code>.
Note that a return value of <code>true</code> indicates successful initiation of the print job but does not guarantee its completion.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_System_Boolean_System_Boolean__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method offers flexibility in the printing process by allowing the user to choose whether to display the print dialog and the print progress dialog.
It is useful for scenarios where either direct printing with default settings is desired or user intervention is required to select specific printer settings.</p>
</div>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_System_Boolean_System_Boolean__examples">Examples</h5>
<pre><code class="lang-csharp">// Assuming 'viewer' is an instance of the Viewer class
// This will print the document silently without showing the print dialog or the print progress dialog
bool printSuccess = viewer.Print(showPrintDialog: false, showPrintProgressDialog: false);
if (printSuccess)
    MessageBox.Show("Printing initiated successfully.");
else
    MessageBox.Show("Printing failed.");</code></pre>



<a id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.Print*"></a>
<h4 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_System_Boolean_System_Boolean_System_Boolean_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.Print(System.Boolean,System.Boolean,System.Boolean)">Print(bool, bool, bool)</h4>
<div class="markdown level1 summary"><p>Initiates the printing process for the currently opened document, with options to display the print dialog, the print progress dialog,
and to use a separate printing thread.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public bool Print(bool showPrintDialog, bool showPrintProgressDialog, bool usePrintingThread)</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.boolean">bool</a></td>
      <td><span class="parametername">showPrintDialog</span></td>
      <td><p>If set to <code>true</code>, the print dialog is displayed, allowing the user to select printer settings
before printing. If set to <code>false</code>, the document is printed using the default printer settings without displaying the print dialog.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">showPrintProgressDialog</span></td>
      <td><p>If set to <code>true</code>, a print progress dialog is displayed during the printing process,
providing the user with feedback on the status of the print job. If set to <code>false</code>, the document is printed without displaying the print progress dialog.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">usePrintingThread</span></td>
      <td><p>If set to <code>true</code>, the printing process is executed on a separate thread, allowing the UI to remain responsive
during printing. If set to <code>false</code>, the printing process is executed on the current thread, which may temporarily block the UI
until the print job is completed.</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.boolean">bool</a></td>
      <td><p>Returns <code>true</code> if the printing process is successfully initiated; otherwise, returns <code>false</code>.
Note that a return value of <code>true</code> indicates successful initiation of the print job but does not guarantee its completion.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_System_Boolean_System_Boolean_System_Boolean__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method provides comprehensive control over the printing process, including whether to display dialogs and whether to use a separate printing thread.
It is designed to accommodate various printing scenarios, from direct printing with default settings to interactive printing with user-selected settings.</p>
</div>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_System_Boolean_System_Boolean_System_Boolean__examples">Examples</h5>
<pre><code class="lang-csharp">// Assuming 'viewer' is an instance of the Viewer class
// This will show both the print dialog and the print progress dialog to the user, and print on the UI thread
bool printSuccess = viewer.Print(showPrintDialog: true, showPrintProgressDialog: true, usePrintingThread: false);
if (printSuccess)
    MessageBox.Show("Printing initiated successfully.");
else
    MessageBox.Show("Printing failed.");</code></pre>

<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.invalidoperationexception">InvalidOperationException</a></td>
      <td><p>Thrown if the method is called while the document is not in a completed load state.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.Print*"></a>
<h4 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_GrapeCity_Viewer_Common_PrintingSettings_" data-uid="GrapeCity.ActiveReports.Viewer.Win.Viewer.Print(GrapeCity.Viewer.Common.PrintingSettings)">Print(PrintingSettings)</h4>
<div class="markdown level1 summary"><p>Initiates the printing process for the currently opened document, using the specified printing settings.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public bool Print(PrintingSettings settings)</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="../MESCIUS.ActiveReports.Viewer.Common/GrapeCity.Viewer.Common.PrintingSettings.html">PrintingSettings</a></td>
      <td><span class="parametername">settings</span></td>
      <td><p>The printing settings to be used for this print job. This includes options for showing the print dialog,
the print progress dialog, and whether to use a separate printing thread.</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.boolean">bool</a></td>
      <td><p>Returns <code>true</code> if the printing process is successfully initiated; otherwise, returns <code>false</code>.
Note that a return value of <code>true</code> indicates successful initiation of the print job but does not guarantee its completion.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_GrapeCity_Viewer_Common_PrintingSettings__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method allows for a flexible printing process by utilizing a <a class="xref" href="GrapeCity.ActiveReports.Viewer.Win.Viewer.PrintingSettings.html#GrapeCity_ActiveReports_Viewer_Win_Viewer_PrintingSettings">PrintingSettings</a> object to specify the desired printing behavior.
It is designed to accommodate various printing scenarios, from direct printing with default settings to interactive printing with user-selected settings.</p>
</div>
<h5 id="GrapeCity_ActiveReports_Viewer_Win_Viewer_Print_GrapeCity_Viewer_Common_PrintingSettings__examples">Examples</h5>
<pre><code class="lang-csharp">// Assuming 'viewer' is an instance of the Viewer class
// Configure printing to show print dialog, print progress dialog, and use a separate printing thread
viewer.Print(PrintingSettings.ShowPrintDialog | PrintingSettings.ShowPrintProgressDialog | PrintingSettings.UsePrintingThread);</code></pre>

<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.invalidoperationexception">InvalidOperationException</a></td>
      <td><p>Thrown if the method is called while the document is not in a completed load state,
indicating that the document is not ready for printing.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
