ABCPdf add document javascript

微笑、不失礼 提交于 2020-01-03 13:55:55

问题


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


回答1:


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;
})();";



回答2:


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;


来源:https://stackoverflow.com/questions/9775674/abcpdf-add-document-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!