Feature #254
Programatically close the viewer
0%
Description
Hi,
I am having trouble with printing. When a PDF is generated, all is nice. When I print, I get only one of the lines I have in my report and the page orientation is not respected etc.
So I thought I capture the print button by assigning a method and produce a PDF in that case. While that works great, the viewer stays open. Can this be changed by
1. either giving me a viewer call to close it
2. or having the method assigned by setPrintCallbackFunction() return a true/false that controls whether the viewer stays open or not
Thanks!
Patrick
History
Updated by Patrick Talbot about 14 years ago
First, do you use a defaultReportParameter printParams object property?
The problem is that I cannot use xhtmlRenderer to print since there is this long standing bug - @see this discussion to know more: [[https://www.servoyforge.net/boards/2/topics/150]]
So I am using Sun's PDFRenderer's lib to print instead, but with this one you have to set the orientation and size of the print explicitely in the printParams object to match the CSS @page you have set in you media=print CSS for it to work reliably. By default it will use US-Letter size and Portrait orientation.
That being said, I can certainly add a close() method to the Viewer object, and have setPrintCallbackFunction() catch the return object as a boolean to close it.
Will add that in next version.
Updated by Patrick Talbot about 14 years ago
- Status changed from New to Closed
Available in v1.4.9
Returning true from the save or print callback function will close the Viewer window.
A close() method has been added to the Viewer object as well.