11

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
  • 1
    As far as i know it's not possible....
    – user746879
    Commented May 10, 2011 at 13:02

5 Answers 5

8

Editable inputs are possible with newer releases of JasperReports.

Example:

<reportElement positionType="Float" mode="Opaque" x="250" y="0" width="200" height="50">
  <property name="net.sf.jasperreports.export.pdf.field.type" value="Text"/>
  <property name="net.sf.jasperreports.export.pdf.field.text.multiline" value="true"/>
  <property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
  <propertyExpression name="net.sf.jasperreports.export.pdf.field.value">"This\nis a multi\nline text inside a single line text field."</propertyExpression>
</reportElement>

Documentation:

http://jasperreports.sourceforge.net/sample.reference/forms/index.html

4

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.

1
  • 2
    My answer was useful when written (more than 9 years ago!). But @yglodt's answer is better now. If Eric Hydrick is around, he should switch to accepting the newer answer.
    – mdahlman
    Commented Jun 24, 2021 at 15:35
1

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?

0

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 ?

1
  • Interesting idea, but using the <html> tag causes errors trying to view the report in design view. Commented Jan 18, 2012 at 18:54
0

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.