How to make editable PDF fields in a Jasper report

心不动则不痛 提交于 2020-01-11 04:49:06

问题


Is there a way to export a Jasper report in PDF where designated fields can be left editable? I'm using iReport to design the report templates.


回答1:


It's not possible today. It's an unusual requirement, but it's not unreasonable. It's really not an iReport limitation but rather a JasperReports limitation. If anyone coming to this post in the future would like to have this feature, the best thing to do would be to log it in the Jaspersoft bug tracker.




回答2:


Two facts:

  1. iText can do it. http://www.geek-tutorials.com/java/itext/itext_acroform_javascript.php#code2src

  2. JasperReports use iText.

Theoretically, JR can do it, but I don't find methods in javadoc, that used parameters.

Maybe anybody know?




回答3:


No you can't but technically it is not impossible. AFAIK,PDF editable field is specific to PDF format itself, JasperReport API is meant to produce only the commons elements to the major files format like text, tables, shapes, images... The best way to find out the tip, is trying with input text for html format, you know you can have html elements in the jrxml. PDF also support html elements isn't it ?




回答4:


Added a "net.sf.jasperreports.export.text.isInputForm" to switch text field and static text component to pdf form text fields. Just set this property to "true" on static text or text field. The fix is just using itext's form within jasperreports.

https://github.com/ozawa-hi/jasperreports/tree/input_text



来源:https://stackoverflow.com/questions/5870145/how-to-make-editable-pdf-fields-in-a-jasper-report

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