But for some business logic, we need to print a report design from Java code programmatically.
Is it possible to print a report from Java on a web application ?
I've tried below code but it didn't work.
Code: Select all
StiReport stiReport = StiReport.newInstance();
stiReport.loadFromJson(modelJsonStr);
StiJsonDatabase jsonDatabase = new StiJsonDatabase("offer");
jsonDatabase.LoadFromJsonObject(new JSONObject(dataJsonString));
stiReport.getDictionary().getDatabases().add(jsonDatabase);
stiReport.render();
PrinterJob printJob1 = StiPrintHelper.preparePrinterJob(stiReport.pages);
StiPrintHelper.printJob(printJob1,stiReport);
java.lang.IllegalArgumentException: Numbers of source Raster bands and source color space components do not match
Maybe I need to try another way ?