RamyaR Posted November 22, 2013 Share Posted November 22, 2013 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 Link to comment Share on other sites More sharing options...
abhimanyu.prasad Posted November 28, 2013 Share Posted November 28, 2013 Replace:JasperDesign design = JRXmlLoader.load(input);[/code]with:JasperDesign design = JRXmlLoader.load(reportFile);[/code]Hope this works. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now