Project

General

Profile

Feature #215

Add a printCallBackFunction parameter to previewReport and previewToComponent

Added by Patrick Talbot over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
overall
Target version:
-
Start date:
01/11/2011
Due date:
% Done:

0%

Estimated time:
Browser (if web client):

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

#1

Updated by Patrick Talbot over 13 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 :)

#2

Updated by Patrick Talbot over 13 years ago

  • Status changed from In Progress to Closed

Check-out v1.3.13

Also available in: Atom PDF