Jump to content
We've recently updated our Privacy Statement, available here ×

Background image is not showing in PDF reports - JAVA


duaa.13

Recommended Posts

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

  • 4 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...