<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Exception when trying to return Report Object]]></title><description><![CDATA[<p>Hi</p>
<p>I am trying to configure JSReport to return PDF from static HTML. I am facing Unhandled exception. This is the same code.</p>
<pre><code>   [MiddlewareFilter(typeof(JsReportPipeline))]
   public async Task&lt;jsreport.Types.Report&gt; InvoiceWithCover()

    {

        var report = await JsReportMVCService.RenderAsync(new RenderRequest()

        {

            Template = new Template

            {

                Content = &quot;&lt;html&gt;&lt;body&gt;&lt;h1&gt;Hello&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;&quot;,

                Engine = Engine.None,

                Recipe = Recipe.ChromePdf

            },

            Options = new RenderOptions()

            {

                Preview = true

            }

        }); 
       return report;
 }
</code></pre>
<p>This is exception message</p>
<p><img src="/uploads/files/1611854808218-screen-shot-2021-01-28-at-5.26.30-pm-resized.png" alt="0_1611854806293_Screen Shot 2021-01-28 at 5.26.30 PM.png" class="img-responsive img-markdown" /></p>
]]></description><link>https://forum.jsreport.net/topic/1880/exception-when-trying-to-return-report-object</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 23:53:36 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/1880.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 28 Jan 2021 17:26:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Exception when trying to return Report Object on Invalid Date]]></title><description><![CDATA[<p>Hi</p>
<p>I am trying to configure JSReport to return PDF from static HTML. I am facing Unhandled exception. This is the same code.</p>
<pre><code>   [MiddlewareFilter(typeof(JsReportPipeline))]
   public async Task&lt;jsreport.Types.Report&gt; InvoiceWithCover()

    {

        var report = await JsReportMVCService.RenderAsync(new RenderRequest()

        {

            Template = new Template

            {

                Content = &quot;&lt;html&gt;&lt;body&gt;&lt;h1&gt;Hello&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;&quot;,

                Engine = Engine.None,

                Recipe = Recipe.ChromePdf

            },

            Options = new RenderOptions()

            {

                Preview = true

            }

        }); 
       return report;
 }
</code></pre>
<p>This is exception message</p>
<p><img src="/uploads/files/1611854808218-screen-shot-2021-01-28-at-5.26.30-pm-resized.png" alt="0_1611854806293_Screen Shot 2021-01-28 at 5.26.30 PM.png" class="img-responsive img-markdown" /></p>
]]></description><link>https://forum.jsreport.net/post/8355</link><guid isPermaLink="true">https://forum.jsreport.net/post/8355</guid><dc:creator><![CDATA[code_blue]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Exception when trying to return Report Object on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="https://forum.jsreport.net/uid/2">@jan_blaha</a> Can you please help with this?</p>
]]></description><link>https://forum.jsreport.net/post/8358</link><guid isPermaLink="true">https://forum.jsreport.net/post/8358</guid><dc:creator><![CDATA[code_blue]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Exception when trying to return Report Object on Thu, 28 Jan 2021 18:15:52 GMT]]></title><description><![CDATA[<p>When you use <code>[MiddlewareFilter(typeof(JsReportPipeline))]</code>, you want to return an MVC View that produces some content and pipe it to jsreport which does report rendering and streams the result to the caller.</p>
<p>When you use <code>JsReportMVCService.RenderAsync</code>, it returns <code>jsreport.Report</code> entity, which wraps the rendering output. You can do what ever you want with it, but you are just returning it from the controller action.  You probably don't want that. The <a href="http://asp.net" rel="nofollow">asp.net</a> mvc tryies to serialize it and fails.</p>
<p>You either should put the HTML to the view and use the jsreport <code>MiddlewareFilter</code>. Or properly return stream from the controller action. You can find the report stream on the <code>report.Content</code>.</p>
<p>Just linking basic example:<br />
<a href="https://github.com/jsreport/jsreport-dotnet-example-webapp" rel="nofollow">https://github.com/jsreport/jsreport-dotnet-example-webapp</a></p>
]]></description><link>https://forum.jsreport.net/post/8359</link><guid isPermaLink="true">https://forum.jsreport.net/post/8359</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Thu, 28 Jan 2021 18:15:52 GMT</pubDate></item><item><title><![CDATA[Reply to Exception when trying to return Report Object on Invalid Date]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="https://forum.jsreport.net/uid/2">@jan_blaha</a> Thanks for your explanation. So i can take stream from report.content and return a byte array or File?<br />
If I am using JsReportMVCService.RenderAsync then i don't need to use the MiddlewareFilter?</p>
]]></description><link>https://forum.jsreport.net/post/8361</link><guid isPermaLink="true">https://forum.jsreport.net/post/8361</guid><dc:creator><![CDATA[code_blue]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Exception when trying to return Report Object on Invalid Date]]></title><description><![CDATA[<p>Yes, you can take <code>report.Content</code> from <code>ReportMVCService.RenderAsync</code> result and return it in the same way as any other stream.</p>
<p>The <code>MiddlewareFilter</code> should be used only when you want to return View.</p>
]]></description><link>https://forum.jsreport.net/post/8362</link><guid isPermaLink="true">https://forum.jsreport.net/post/8362</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>