JasperReports - how to save as PDF from Print Preview page?
527664Oct 25 2006 — edited Oct 26 2006Hi all!
How can I save reports created with JasperReperts (with iReport tool) as PDF?
On print preview, when I select it is as PDF, and click on "save", nothing is saved. Also, I get NoClassDefFoundError despite I included all nessesry classes (did I?). Here are list of included classes
jasperreports-1.2.7.jar;
jasperreports-1.2.7-javaflow.jar;
commons-beanutils-1.5.jar;
commons-collections-2.1.jar;
commons-logging-1.0.2.jar;
commons-digester-1.7.jar;
Here is my code:
void printWithPreview() {
try {
JasperPrint print = JasperFillManager.fillReport(report, reportParam, conn);
JasperViewer.viewReport(print, false);
//byte[] pdfasbytes = JasperExportManager.exportReportToPdf(print); // can I use it somehow?
JasperExportManager.exportReportToPdf(print);
} catch (JRException e) {
e.printStackTrace();
}
}
Can you help me with this?
Also, I need to know, how to limit options "save as" only to PFD (on same Print Preview page)?
Thank you in advance!