Created
November 18, 2016 07:48
-
-
Save quchie/5c745682c032bc638c299ee3775c0cb1 to your computer and use it in GitHub Desktop.
Jasper print with XML datasource (API 6.x.x)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Forget about XML datasource, somehow it wont work... :( just need to pass xml in parameters to make it work.. | |
//Lets say we have strings of XML or XML file or whatever in xml | |
String xmlDoc = '''<tag>PMHGK5860HD301330</tag>''' | |
Map parameters = new HashMap(); | |
parameters.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, xmlDoc); | |
parameters.put("chasisno", chassisno); | |
parameters.put("imgFolderPath", path); | |
JasperPrint jasperPrint = JasperFillManager.fillReport("REPORT_FILE.jasper", parameters, connection); | |
//Go ahead and print how ever you want (This is windows path) :) | |
JasperExportManager.exportReportToPdfFile(jasperPrint, "C:\\REPORTS\\REPORT_FILE.pdf"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment