2

I want to embed a javascript function into a pdf file generated by jasper. it comes to my mind because I want to make the pdf file auto open printing dialog. after reading this question and tried this example I want to do the same.

but I use iReport designer to create my pdf templates and then export using struts actions, any idea how to embed javascript with ireport?

thanks

Community
  • 1
  • 1
Yichaoz
  • 8,686
  • 9
  • 50
  • 91

1 Answers1

1

You can try to use the net.sf.jasperreports.export.pdf.javascript property.

The information about this property is here.

Alex K
  • 21,796
  • 18
  • 106
  • 231
  • 1
    That helped me to know what to search!. completing the answer I added this line to make it work: exporter.setParameter(JRPdfExporterParameter.PDF_JAVASCRIPT, "this.print();"); – Yichaoz Jan 09 '12 at 16:00