shanthusharma Posted July 22, 2008 Share Posted July 22, 2008 I have a .jrxml file, its got data from .csv file. all are working properly. and also i saved the output into .pdf file. but now i got a problem. when i tried to call my pdf file into java swing using jeditorpane. setpage(). its wont display some times its display the no protocol error at run time. My problem is I want to display the pdf fill, when i click the button in java, it has to display. Can any one guide the correct waythis is the codingtry{ JRCsvDataSource jcvs; char fieldDelimiter = '~'; String recordDelimiter = "n"; String outFileName ="Drep.pdf"; URL csvurl = getClass().getResource("drep.csv"); String csvpath = csvurl.getPath().replaceAll("%20"," "); File csv = new File(csvpath); jcvs = new JRCsvDataSource(new File(csv.getAbsolutePath())); jcvs.setFieldDelimiter(fieldDelimiter); jcvs.setRecordDelimiter(recordDelimiter); jcvs.setUseFirstRowAsHeader(true); URL jasurl = getClass().getResource("DRep.jasper"); String jaspath = jasurl.getPath().replaceAll("%20"," "); JasperPrint jasperPrint = JasperFillManager.fillReport(jaspath,null,jcvs); JRExporter exporter = new net.sf.jasperreports.engine.export.JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,outFileName); exporter.exportReport(); URL rurl = getClass().getResource("Dpooja.pdf"); jedPan.setPage(rurl);}Thanks i advance Link to comment Share on other sites More sharing options...
lshannon Posted July 22, 2008 Share Posted July 22, 2008 Could this be a timing issue? Maybe try putting the export code in its own thread, then have the main thread sleep for the max fill times you have seen your report take? 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