What is the equivalent of stamper.AddJavaScript function (iText 5) with iText7 (.NET)?

有些话、适合烂在心里 提交于 2019-12-24 19:44:21

问题


We are writing a program that needs to insert document-level JavaScript with iText 7. We founded that with iText 5, the solution was Stamper.AddJavaScript().


回答1:


It depends on the type of event you want your JavaScript code to be triggered at.

For instance, to define an action that would be executed as soon as the document is opened, use PdfDocument#getCatalog().setOpenAction.

Example for opening a print dialog when the document is opened:

pdfDocument.getCatalog().setOpenAction(PdfAction.createJavaScript("this.print(true);"));


来源:https://stackoverflow.com/questions/48751255/what-is-the-equivalent-of-stamper-addjavascript-function-itext-5-with-itext7

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