-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello everyone
I have problems when trying to print a modal window which is in a zul file named preview.zul
In the parent controller I have the following code that calls the modal window
Window window = (Window) Executions.createComponents("/app/preview.zul", null, previewParams); window.doModal();
and the in preview.zul file containing this window that I want to print , I put the instruction :
<button id="btnTestPrint" label="Test print"/>
And finally in the preview controller, preview.java, I added:
***public void onClick$btnTestPrint() {
Clients.print();
}***
The problem is that instead of printing only the content of the modal window, It also prints the parent window which is displayed behind
Could someone please show me how to print only the content of my preview.zul file and nothing else?
Thank you
you can add a print style to your page e.g.:
<style media="print">
body > *:not(.printable) {
display: none !important;
}
.printable {
top: 0 !important;
left: 0 !important;
}
</style>
<window title="myModal" mode="modal" sizable="true" width="500px"
sclass="printable" ...
and then apply the sclass="printable" only to the modal dialog to print, the style will also move it to the top left, so that no printing space is wasted (optional). Any other root element on the page will be made invisible.
I hope this helps,
Robert
Hello
Thank you Robert for your answer
Unfortunately it didn't work :-(
I did it in many ways, either by putting the style mentionned in your post in the parent window, or by putting it in the common stylesheet of the whole application this way:
@media print {
body > *:not(.printable) {
display: none !important;
}
.printable {
top: 0 !important;
left: 0 !important;
}
}
But in both cases, it still prints the window in the background and on top of it the modal window...as if it prints all the windows displayed on the screen one on the other ..... Still need help please Thanks again!
Asked: 2014-07-17 20:25:55 +0800
Seen: 34 times
Last updated: Jul 18 '14