duaa.13 Posted December 17, 2019 Share Posted December 17, 2019 Hello , I'm new to Jaspersoft and i'm trying to generate a jasper report to PDF but the file is empty no backgound image or Static Text lables , the only thing that works is Parameters ! i'm not facing any errors but i'm not sure what's the issue here. this is the Java code i'm using to generate PDF file from jasper report: JasperReport jasperReport = null;try { jasperReport = JasperCompileManager.compileReport("C:/jasperoutput/testimg.jrxml"); JRDataSource dataSource = new JREmptyDataSource(); Map<String, Object> parameters = new HashMap<String, Object>(); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd"); LocalDate localDate = LocalDate.now(); HijrahDate hijradate = HijrahDate.from(localDate); parameters.put("GregorianDate",dtf.format(localDate)); parameters.put("HijriDate",dtf.format(hijradate)); parameters.put("Parameter1",reportModel.registrationID); parameters.put("Parameter2",reportModel.ownerName); parameters.put("Parameter3",reportModel.authorizedName); parameters.put("Parameter4",reportModel.authorizationDate); parameters.put("Parameter5",reportModel.classifierAddress); parameters.put("Parameter6",reportModel.classifierType); parameters.put("Parameter7",reportModel.authorName); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, dataSource); File outDir = new File("C:/jasperoutput"); outDir.mkdirs(); JasperExportManager.exportReportToPdfFile(jasperPrint, "C:/jasperoutput/Certificate.pdf");} catch (JRException e) { e.printStackTrace();}[/code] Link to comment Share on other sites More sharing options...
teodord Posted January 9, 2020 Share Posted January 9, 2020 Hi,It is more useful to see the JRXML and the resulting PDF in this case. Maybe you can attach them here.Thank you,Teodor 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