<?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[HELP Strategy Required in ASPNETCORE 2]]></title><description><![CDATA[<p>I have a class that is being used as a strategy to convert HTML to PDF.</p>
<p>public byte[] Execute(byte[] document, Dictionary&lt;string, string&gt; parameters)<br />
{<br />
try<br />
{<br />
var localReporting = new LocalReporting();</p>
<pre><code>            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                localReporting.UseBinary(jsreport.Binary.OSX.JsReportBinary.GetBinary());
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                localReporting.UseBinary(jsreport.Binary.OSX.JsReportBinary.GetBinary());
            } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                localReporting.UseBinary(jsreport.Binary.JsReportBinary.GetBinary()); 
            }
                     
            ILocalUtilityReportingService reportingService = localReporting.AsUtility().Create();

            var report = reportingService.RenderAsync(new RenderRequest()
            {
                Template = new Template()
                {
                    Recipe = Recipe.PhantomPdf,
                    Engine = Engine.None,
                    Content = Encoding.UTF8.GetString(document)
                }
            });
            report.Wait();

            return report.Result.Content.ToByteArray();
        }
        catch(Exception ex)
        {
            return null;   
        }
    }
</code></pre>
<p>When I call this Execute method, either from my controller action or via a console app I get the error message exception :</p>
<p>{jsreport.Local.JsReportBinaryException: Error rendering report:     at jsreport.Local.Internal.LocalUtilityReportingService.&lt;RenderAsync&gt;d__10.MoveNext()}</p>
<p>I have added the NuGet packages; jsreport.aspnetcore, jsreport.Binary.Linux (&amp; OSX, Windows), jsreport.Local.  The intention is pass any HTML to the strategy and get a PDF returned.</p>
<p>Appreciate any help and questions.</p>
]]></description><link>https://forum.jsreport.net/topic/363/help-strategy-required-in-aspnetcore-2</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Mar 2026 03:13:45 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/363.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 30 Dec 2017 15:08:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to HELP Strategy Required in ASPNETCORE 2 on Invalid Date]]></title><description><![CDATA[<p>I have a class that is being used as a strategy to convert HTML to PDF.</p>
<p>public byte[] Execute(byte[] document, Dictionary&lt;string, string&gt; parameters)<br />
{<br />
try<br />
{<br />
var localReporting = new LocalReporting();</p>
<pre><code>            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                localReporting.UseBinary(jsreport.Binary.OSX.JsReportBinary.GetBinary());
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                localReporting.UseBinary(jsreport.Binary.OSX.JsReportBinary.GetBinary());
            } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                localReporting.UseBinary(jsreport.Binary.JsReportBinary.GetBinary()); 
            }
                     
            ILocalUtilityReportingService reportingService = localReporting.AsUtility().Create();

            var report = reportingService.RenderAsync(new RenderRequest()
            {
                Template = new Template()
                {
                    Recipe = Recipe.PhantomPdf,
                    Engine = Engine.None,
                    Content = Encoding.UTF8.GetString(document)
                }
            });
            report.Wait();

            return report.Result.Content.ToByteArray();
        }
        catch(Exception ex)
        {
            return null;   
        }
    }
</code></pre>
<p>When I call this Execute method, either from my controller action or via a console app I get the error message exception :</p>
<p>{jsreport.Local.JsReportBinaryException: Error rendering report:     at jsreport.Local.Internal.LocalUtilityReportingService.&lt;RenderAsync&gt;d__10.MoveNext()}</p>
<p>I have added the NuGet packages; jsreport.aspnetcore, jsreport.Binary.Linux (&amp; OSX, Windows), jsreport.Local.  The intention is pass any HTML to the strategy and get a PDF returned.</p>
<p>Appreciate any help and questions.</p>
]]></description><link>https://forum.jsreport.net/post/1729</link><guid isPermaLink="true">https://forum.jsreport.net/post/1729</guid><dc:creator><![CDATA[MIKE-R-PALMER]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to HELP Strategy Required in ASPNETCORE 2 on Invalid Date]]></title><description><![CDATA[<p>Full method code here:</p>
<p>public byte[] Execute(byte[] document, Dictionary&lt;string, string&gt; parameters)<br />
{<br />
try<br />
{<br />
var localReporting = new LocalReporting();</p>
<pre><code>            if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                localReporting.UseBinary(jsreport.Binary.OSX.JsReportBinary.GetBinary());
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                localReporting.UseBinary(jsreport.Binary.OSX.JsReportBinary.GetBinary());
            } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                localReporting.UseBinary(jsreport.Binary.JsReportBinary.GetBinary()); 
            }
                     
            ILocalUtilityReportingService reportingService = localReporting.AsUtility().Create();

            var report = reportingService.RenderAsync(new RenderRequest()
            {
                Template = new Template()
                {
                    Recipe = Recipe.PhantomPdf,
                    Engine = Engine.None,
                    Content = Encoding.UTF8.GetString(document)
                }
            });
            report.Wait();

            return report.Result.Content.ToByteArray();
        }
        catch(Exception ex)
        {
            return null;   
        }
    }</code></pre>
]]></description><link>https://forum.jsreport.net/post/1730</link><guid isPermaLink="true">https://forum.jsreport.net/post/1730</guid><dc:creator><![CDATA[MIKE-R-PALMER]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to HELP Strategy Required in ASPNETCORE 2 on Invalid Date]]></title><description><![CDATA[<p>Should add, I am running this in a docker container, linux based.</p>
]]></description><link>https://forum.jsreport.net/post/1731</link><guid isPermaLink="true">https://forum.jsreport.net/post/1731</guid><dc:creator><![CDATA[MIKE-R-PALMER]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to HELP Strategy Required in ASPNETCORE 2 on Invalid Date]]></title><description><![CDATA[<p>&lt;h1&gt;An unhandled exception occurred while processing the request.&lt;/h1&gt;<br />
&lt;div class=&quot;titleerror&quot;&gt;AggregateException: One or more errors occurred. (Error rendering report: )&lt;/div&gt;<br />
&lt;p class=&quot;location&quot;&gt;System.Threading.Tasks.Task.ThrowIfExceptional(bool includeTaskCanceledExceptions)&lt;/p&gt;<br />
&lt;div class=&quot;titleerror&quot;&gt;JsReportBinaryException: Error rendering report: &lt;/div&gt;<br />
&lt;p class=&quot;location&quot;&gt;jsreport.Local.Internal.LocalUtilityReportingService+&lt;RenderAsync&gt;d__10.MoveNext()&lt;/p&gt;</p>
<p>Even if I put HTML directly in the Content field the same error occurs.  I have tried running it locally but I am using HighSierra and PhantomPdf throws errors.  So have reverted back to the Docker container; and get the same error.</p>
]]></description><link>https://forum.jsreport.net/post/1732</link><guid isPermaLink="true">https://forum.jsreport.net/post/1732</guid><dc:creator><![CDATA[MIKE-R-PALMER]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to HELP Strategy Required in ASPNETCORE 2 on Invalid Date]]></title><description><![CDATA[<p>The exception should include output logs from jsreport. Please inspect <a href="https://github.com/jsreport/jsreport-dotnet-local/blob/master/jsreport.Local/JsReportBinaryException.cs#L13" rel="nofollow">this</a> exception property.</p>
<p>However looking at your code, I think you have very ugly copy and paste error there :)</p>
<pre><code class="language-c#">else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                localReporting.UseBinary(jsreport.Binary.OSX.JsReportBinary.GetBinary());
            }
</code></pre>
]]></description><link>https://forum.jsreport.net/post/1747</link><guid isPermaLink="true">https://forum.jsreport.net/post/1747</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to HELP Strategy Required in ASPNETCORE 2 on Invalid Date]]></title><description><![CDATA[<p>You seems to be using OSX binary on Linux host...</p>
]]></description><link>https://forum.jsreport.net/post/1748</link><guid isPermaLink="true">https://forum.jsreport.net/post/1748</guid><dc:creator><![CDATA[jan_blaha]]></dc:creator><pubDate>Invalid Date</pubDate></item></channel></rss>