Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JasperReports - how to save as PDF from Print Preview page?

527664Oct 25 2006 — edited Oct 26 2006
Hi 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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 23 2006
Added on Oct 25 2006
3 comments
708 views