save ireport to pdf
Apologies if this isn't the appropriate forum for this topic.
I have created a simple report using ireport and it runs fine within ireport.
However when I attempt to create a pdf file from the .jasper file then I don't appear to get any data. The pdf file is indeed created but it displays only 'null' for both of my fields.
I have trawled through the jasperforge site trying to figure out the cause of the problem but to no avail.
My simple code is shown below:
JasperReport jasperReport;
JasperPrint jasperPrint;
try
{
jasperPrint = JasperFillManager.fillReport("C:/Untitled_report_11.jasper",new HashMap(),new JREmptyDataSource());
JRExporter exporter =new net.sf.jasperreports.engine.export.JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"Y:/my IReport Stuff/netbean.pdf");
exporter.exportReport();
}
catch (JRException e)
{
e.printStackTrace();
}
I have a feeling that the empty data source is the problem, but not sure why as the compiled .jasper file to the best of my knowledge already has the data.
If anyone can offer any pointers here then they would be very much appreciated.
Regards
GB
Message was edited by:
greenockboy

