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
Yichz
  • 9,250
  • 10
  • 54
  • 92

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
  • 22,315
  • 19
  • 108
  • 236
  • 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();"); – Yichz Jan 09 '12 at 16:00