Feature #215
Add a printCallBackFunction parameter to previewReport and previewToComponent
0%
Description
To workaround printing issues with different formats, a callback would be done to a method, passing the PDF bytes in parameter.
The callback method would then be able to save to a temp file and call the native print function using standard Servoy code.
Something like:
function printCallbackFuntion(pdf) {
var _pdfpath = plugins.file.createTempFile('temp','.pdf');
plugins.file.writeFile(_pdfpath, pdf);
if (utils.stringMiddle( application.getOSName(), 1, 7) == "Windows") {
application.executeProgramInBackground('rundll32', 'url.dll,FileProtocolHandler', _pdfpath);
} else if (utils.stringLeftWords(application.getOSName(), 1) == "Mac") {
application.executeProgram('open', _pdfpath);
}
}
History
Updated by Patrick Talbot over 14 years ago
- Status changed from New to In Progress
There will be 3 ways of setting the printCallbackFunction:
1/ using the defaultPreviewParameters:
plugins.VelocityReport.addDefaultPreviewParameter("printCallback", printCallbackFunction);
ou
plugins.VelocityReport.setDefaultPreviewParameters({"printCallback": printCallbackFunction});
2/ passing it as parameter to the previewReport or previewToComponent method:
plugins.VelocityReport.previewReport(template,context,saveCallbackFunction, printCallbackFunction);
et
plugins.VelocityReport.previewToComponent(elements.beanJPanel, template, context, saveCallbackFunction, printCallbackFunction);
3/ setting the function directly to the Viewer object (returned by previewReport or previewToComponent)
var viewer = plugins.VelocityReport.previewReport(template,context);
viewer.setPrintCallbackFunction(printCallbackFunction);
Will be available with v1.3.13+ - coming soon :)
Updated by Patrick Talbot over 14 years ago
- Status changed from In Progress to Closed
Check-out v1.3.13