iTextSharp: Javascript in PDF not firing when filled in in vb.Net

左心房为你撑大大i 提交于 2019-12-24 16:14:50

问题


I use iTextSharp to fill in the PDF server-sided and return it so that the client can download it.

Here's the link to the pdf.

The problem is number 1. You can only fill in the PDF if you have one of the boxes checked. If none is checked, everything will be "empty". The content isn't removed and returns once a box has been checked.

Everything gets populated, but there is a problem. The checkbox gets checked, but the Javascript behind it doesn't fire. Any solutions?


回答1:


When you use iText(Sharp) to fill in forms, Javascript events wont be triggered.

Many events make no sense, no focus is gained or lost, no keys are typed, iText(Sharp) directly changes the PDF objects, it does not emulate a person filling in the forms.

Furthermore, iText(Sharp) does not include a JavaScript execution environment with an Adobe Reader object model to begin with.


Any solutions?

While I wrote the above, @Bruno already explained in a comment that you can either

  • vote to get some kind of Javascript support on the roadmap of iText if you are a paying iText customer;
  • wait and hope other iText users who are iText customers vote that onto the roadmap if you are not a paying iText customer;
  • implement such a Javascript support into iText yourself; it's open source after all; but be aware of the viral iText license; or
  • analyze the Javascript in your PDF and hard code analogous operations into your code


来源:https://stackoverflow.com/questions/35014807/itextsharp-javascript-in-pdf-not-firing-when-filled-in-in-vb-net

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