ABCPdf add document javascript
Asked Answered
A

2

7

Is it possible to add document JavaScripts to a generated PDF using ABCPdf?

Alvira answered 19/3, 2012 at 18:21 Comment(0)
W
4

If you mean, Javascript that is being executed after the document has been loaded, then have a look at this documentation page.

doc.HtmlOptions.UseScript = true;
doc.HtmlOptions.GeckoSubset.OnLoadScript =
@"(function() {
   window.ABCpdf_go = false;

   // your javascript code here

   window.ABCpdf_go = true;
})();";
Wahoo answered 20/11, 2012 at 21:12 Comment(1)
Been trying to render google charts with ABc.pdf for quite a while, and this made it work. Thanks!Mcgannon
W
1

I think you should be able to. There are some settings in the c# which will help.

You need to set the

doc.HtmlOptions.UseScript = true; 

this will enable javascript to run.

it's probably worth setting the timeout to give it more time to finish loading

doc.HtmlOptions.Timeout = 10000;

and i've always had better results with the gecko rendering engine

doc.HtmlOptions.Engine = EngineType.Gecko;
Whish answered 31/10, 2012 at 11:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.