# C1.Ssrs.ReportSession.GetContent

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Ssrs_ReportSession_GetContent_" data-uid="C1.Ssrs.ReportSession.GetContent*">GetContent Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Ssrs_ReportSession_GetContent_" data-uid="C1.Ssrs.ReportSession.GetContent*"></a>
<h4 id="C1_Ssrs_ReportSession_GetContent_System_Int32_System_Int32_C1_Ssrs_ReportSession_ReportFormat_C1_Ssrs_PageLayout_System_Nullable_System_Int32__System_Nullable_System_Int32__System_Threading_CancellationToken_" data-uid="C1.Ssrs.ReportSession.GetContent(System.Int32,System.Int32,C1.Ssrs.ReportSession.ReportFormat,C1.Ssrs.PageLayout,System.Nullable{System.Int32},System.Nullable{System.Int32},System.Threading.CancellationToken)">GetContent(int, int, ReportFormat, PageLayout, int?, int?, CancellationToken)</h4>
<div class="markdown level1 summary"><p>Generates report in specific format.
<code class="paramref">startPageIndex</code> and <code class="paramref">pageCount</code> specify
range of pages, set <code class="paramref">pageCount</code> to 0 to request all pages of the report.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public byte[] GetContent(int startPageIndex, int pageCount, ReportSession.ReportFormat format, PageLayout pageLayout, int? dpiX, int? dpiY, CancellationToken cancellationToken)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function GetContent(startPageIndex As Integer, pageCount As Integer, format As ReportSession.ReportFormat, pageLayout As PageLayout, dpiX As Integer?, dpiY As Integer?, cancellationToken As CancellationToken) As Byte()</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.int32">int</a></td>
      <td><span class="parametername">startPageIndex</span></td>
      <td><p>The first page of the report to render.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pageCount</span></td>
      <td><p>Count of pages to load, set this parameter to 0 to request all pages of the report, <code class="paramref">startPageIndex</code> ignored in this case.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Ssrs.ReportSession.html">ReportSession</a>.<a class="xref" href="C1.Ssrs.ReportSession.ReportFormat.html">ReportFormat</a></td>
      <td><span class="parametername">format</span></td>
      <td><p><a class="xref" href="C1.Ssrs.ReportSession.ReportFormat.html">ReportSession.ReportFormat</a> object specifies the report format.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Ssrs.PageLayout.html">PageLayout</a></td>
      <td><span class="parametername">pageLayout</span></td>
      <td><p><a class="xref" href="C1.Ssrs.PageLayout.html">PageLayout</a> object specifies the page settings, this parameter used only for PDF and IMAGE formats.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>?</td>
      <td><span class="parametername">dpiX</span></td>
      <td><p>Specifies print horizontal dpi, used only for EMF format, see PrintDpiX in SSRS help.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>?</td>
      <td><span class="parametername">dpiY</span></td>
      <td><p>Specifies print vertical dpi, used only for EMF format, see PrintDpiY in SSRS help.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></td>
      <td><span class="parametername">cancellationToken</span></td>
      <td><p><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a> that can be used to cancel an action.</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.byte">byte</a>[]</td>
      <td><p>Array of bytes contains generated content, <b>null</b> if action was cancelled.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Ssrs_ReportSession_GetContent_" data-uid="C1.Ssrs.ReportSession.GetContent*"></a>
<h4 id="C1_Ssrs_ReportSession_GetContent_System_String_System_String_System_Threading_CancellationToken_" data-uid="C1.Ssrs.ReportSession.GetContent(System.String,System.String,System.Threading.CancellationToken)">GetContent(string, string, CancellationToken)</h4>
<div class="markdown level1 summary"><p>Gets report content in specific format.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public byte[] GetContent(string format, string deviceInfo, CancellationToken cancellationToken)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function GetContent(format As String, deviceInfo As String, cancellationToken As CancellationToken) As Byte()</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">format</span></td>
      <td><p>Strings specifies report format &quot;PDF&quot;, &quot;IMAGE&quot; etc.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">deviceInfo</span></td>
      <td><p>DeviceInfo string specifies additional parameters.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></td>
      <td><span class="parametername">cancellationToken</span></td>
      <td><p><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a> that can be used to cancel an action.</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.byte">byte</a>[]</td>
      <td><p>Array of bytes contains generated content.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
