I am developing a pdf report using DynamicJasper API.
As per requirement I have to display one logo at header and other at footer. I am able to display logo at header by using DynamicReportBuilder.addImageBanner method. But i didn't find a way to add an image at footer.
I saw some threads regarding this issue in dynamic-jasper forum , the one work around which mentioned there is to create a jrxml template with pageFooter band.
I tried this, but didn't work out. I got following exception:
org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed
Following is the code which generate report.
- Creating a dynamiceReport object
- Creating a jasperPrint object
- Invoking a method which create report based on the format type. Here i have to pass jasperPrint object, which has jrxml representation, target file location and report format type.
// ...
DynamicReport dynamicReport = buildDynamicReport(reportTemplate, grpFields);
// build jrxml <br/>
JasperPrint jasperPrint = buildJRXML(dynamicReport, dataSource, reportFormat);
// export the report into specific target format <br/>
exportReport(jasperPrint, targetReportFile, reportFormat);
// ...
private DynamicReport buildDynamicReport(Template reportTemplate,
Vector<String[]> groupFields) throws ServiceException {
/** code to generate DynamicReport object. */
dynamicReportBuilder.setTemplateFile("jrxml/report-footer.jrxml");
DynamicReport dynamicReport = dynamicReportBuilder.build();
return dynamicReport;
}
Any help would be appreciate.