berdohan Posted January 13, 2009 Share Posted January 13, 2009 Hi all;I am interesting to create a PDF file from java class using .jasper file.Also my datasource is a XML file datasource. I particularly managed to do it. My jasper file works exactly when I execute jrxml file in IReport3..0.0. It creates and views my report that filled up with correct data. If I try to get my report calling from java.class , report looks like empty columns and number of data amount *2. Here is my codes and other files are been athachment to msg.Does anyone tell me how I get my report with correct data and use the variable xmldatasource file?Best regards.berdohanCode: Link to comment Share on other sites More sharing options...
berdohan Posted January 17, 2009 Author Share Posted January 17, 2009 Hi allyou can find the code patch below .Good luck. Link to comment Share on other sites More sharing options...
zarfishan.biztek Posted August 5, 2013 Share Posted August 5, 2013 Use this PDF Creatorits a cloud based API that uses java language and also allows you to read and convert pdf files to many other formats saves your time of coding and handling errors. Best of luck. Link to comment Share on other sites More sharing options...
berdohan Posted January 17, 2017 Author Share Posted January 17, 2017 try {JRXmlDataSource jrxmlds = new JRXmlDataSource(xmlFileName,recordPath);JasperPrint print = JasperFillManager.fillReport(reportFileName,hm,jrxmlds);JRExporter exporter= new JRPdfExporter();exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,outFileName);exporter.setParameter(JRExporterParameter.JASPER_PRINT,print); exporter.exportReport();Runtime r = Runtime.getRuntime();try {String app = {"C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe",outFileName};Process process = r.exec(app);System.out.println("app= "+app);}catch (Exception ee){} }catch (JRException ex1){ ex1.printStackTrace(); System.exit(1); }catch (Exception ex2){ ex2.printStackTrace(); System.exit(1); }} 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