Skip to content

Instantly share code, notes, and snippets.

@esaounkine
Created April 29, 2011 07:44
Show Gist options
  • Save esaounkine/948000 to your computer and use it in GitHub Desktop.
Save esaounkine/948000 to your computer and use it in GitHub Desktop.
Silent Jasper print sample
public void createReport(String[] jasperFileUrls, Map parameters, JRDataSource ds, String type,
String selectedPrinter) {
Vector jasperPrintList = new Vector(0);
for(String s : jasperFileUrls) {
try {
jasperPrintList.add(JasperFillManager.fillReport((JasperReport)JRLoader.loadObject(s), parameters, ds));
System.out.println("Added report: " + s + " to the printlist");
}
catch(JRException jre) {
System.err.println("Failed to add the report '" + s + "' due to exception: " +
jre.getMessage());
}
}
try {
printReport(jasperPrintList, selectedPrinter);
}
catch(Exception e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment