Note that there are some explanatory texts on larger screens.

plurals
  1. POABCPdf giving "Unable to render HTML. Unable to apply JScript" even with simple OnLoadScript
    text
    copied!<p>I'm trying to do some simple DOM manipulation when a page is rendered as a PDF using ABCPdf. I followed what they document here: <a href="http://www.websupergoo.com/helppdf9net/source/5-abcpdf/xhtmloptions/2-properties/usescript.htm" rel="nofollow">http://www.websupergoo.com/helppdf9net/source/5-abcpdf/xhtmloptions/2-properties/usescript.htm</a></p> <p>But when I try something as simple as the following:</p> <pre><code>var doc = new Doc(); doc.HtmlOptions.UseScript = true; doc.HtmlOptions.UseNoCache = true; doc.HtmlOptions.PageCachePurge(); doc.HtmlOptions.OnLoadScript = @"var reportElms = document.getElementsByClassName(""report"");"; doc.Page = doc.AddPage(); doc.AddImageUrl(Url.Action("TestPdf", "Pdf", new { }, "http")); </code></pre> <p>I get the exception:</p> <pre><code>Unable to render HTML. Unable to apply JScript. COM error 80020101. Script 'var reportElms = document.getElementsByClassName("report");'. </code></pre> <p>Any thoughts as to what I'm doing wrong?</p> <p><strike><strong>Not even the built in functions work</strong></p> <p>I'm even getting the same exception with the following script:</p> <pre><code>doc.HtmlOptions.OnLoadScript = @" window.ABCpdf_RenderWait(); window.ABCpdf_RenderComplete();"; </code></pre> <p></strike></p> <p>Btw, I'm using version 8 because that's what we have a licence for.</p> <p><strong>Edit:</strong> </p> <p>I was missing the <code>.external</code> for the <code>ABCpdf_RenderWait()</code> and <code>ABCpdf_RenderComplete()</code> calls. It works if you reference them properly (imagine that):</p> <pre><code>doc.HtmlOptions.OnLoadScript = @" window.external.ABCpdf_RenderWait(); window.external.ABCpdf_RenderComplete();"; </code></pre> <p>Though as I mention in my answer, there are a lot of security hoops that need to be jumped through for IE also.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload