Blank pdf report created in output folder while exporting report designed using ireport

0

Hi,

 

Im using Jdev 11.1.2.4.0 version

 

  I designed a report in jasper iReport tool (version 5.5.0) to get a pdf file.

  I have also used the required jar files.  I was able to preview the pdf report in iReport , thus no error in the designed report.

And I didnt get any error while debugging the source  but a BLANK pdf was exported in the mentioned output folder.

 

The below is the source code used:

 

            String fileName = "Sample.pdf";

            String jrxmlName = "sample.jrxml";

            ApplicationModuleImpl appM = (ApplicationModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");

            StringBuilder reportSpoolFile = new StringBuilder();

            reportSpoolFile.append(fileName);

            Map<String,Object> param = new HashMap<String,Object>();

            File reportFile     = new File("D:\\Jdev11gR1\\mywork\\Application6\\ViewController\\public_html\\reports\\" + jrxmlName);

            InputStream input   = new FileInputStream(reportFile);

            JasperDesign design = JRXmlLoader.load(input);

            JasperReport report = JasperCompileManager.compileReport(design);

            PreparedStatement pre = appM.getDBTransaction().createPreparedStatement("commit", 1);

            Connection conn = pre.getConnection();

            JasperPrint print   = JasperFillManager.fillReport(report, param, conn);

            FileOutputStream fos = new FileOutputStream("D:\\output\\" + fileName);

            JRPdfExporter exporter = new JRPdfExporter();

            exporter.setParameter(JRExporterParameter.JASPER_PRINT,         print);

            exporter.setParameter(JRExporterParameter.OUTPUT_STREAM,      fos );

            exporter.exportReport();

            input.close();

            fos.close();

 

Any configuration need to be done?

Please help me out from this issue.

 

Thanks,

Ramya

 

RamyaR's picture
2
Joined: Nov 14 2013 - 10:32am
Last seen: 5 years 10 months ago

1 Answer:

-1

Replace:

JasperDesign design = JRXmlLoader.load(input);

with:

JasperDesign design = JRXmlLoader.load(reportFile);

Hope this works.

abhimanyu.prasad's picture
Joined: Nov 25 2013 - 2:18am
Last seen: 4 years 5 months ago
Feedback