HTML is stored on views and views are loaded from actions of controllers.
The trick is: the reports data is loaded asynchronously when the use is interacting with the application. When it's time to print, the report data comes from the action. There is not asynchronous data fetch. The report printer class will get user cookies and will pass them to the wkhtmltopdf so that it can gain access to the url. After saving the PDF file.
On the controller class:
@Printable(name="reportName")
public void controllerAction(Map Params){
if(params.contains("$print")){
//fetch data and pass to the view
return;
}
//just call the view and let the report be filled asynchronously
}
HTML is stored on views and views are loaded from actions of controllers. The trick is: the reports data is loaded asynchronously when the use is interacting with the application. When it's time to print, the report data comes from the action. There is not asynchronous data fetch. The report printer class will get user cookies and will pass them to the wkhtmltopdf so that it can gain access to the url. After saving the PDF file.
On the controller class:
When it's time to print: