Jump to content

duaa.13

Members
  • Posts

    2
  • Joined

  • Last visited

 Content Type 

Forum

Downloads

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Events

Profiles

Everything posted by duaa.13

  1. 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]
  2. Hello , i'm new to Jaspersoft and i'm trying to use it with my Java code , i have import a file that I implemnted it using Jaspersoft Studio and that life contains an imge as background. I have added this imge to my code and changed the img path too. but when i try to convert jasper file to pdf , i get the below error : and i'm using the below code : JasperReport jasperReport = null;try { jasperReport = JasperCompileManager.compileReport("C:/jasperoutput/Test3.jrxml"); JRDataSource dataSource = new JREmptyDataSource(); Map<String, Object> parameters = new HashMap<String, Object>(); 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"); if(!outDir.exists()){ outDir.mkdirs(); } JasperExportManager.exportReportToPdfFile(jasperPrint, "C:/jasperoutput/Certificate.pdf");} catch (JRException e) { e.printStackTrace();}[/code]
×
×
  • Create New...