Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Printing prints only first page

Christian Wahl
9 years ago Aug 27, 2013 8:44am

Hi there,

i've got a problem with printing a Vaadin page. I open my printpage in a seperate window. All data is displayed in this window. But if I try to print the page, my printer throws out only the first page. There are more data than that on the page and it gets lost.

Any clues ?
Thanks!

Marius Reinwald
9 years ago Aug 27, 2013 8:51am
Christian Wahl
9 years ago Aug 27, 2013 9:15am
Thomas Mattsson
9 years ago Aug 28, 2013 12:28pm
Christian Wahl
9 years ago Aug 28, 2013 1:13pm

Thanks Thomas, i tried to set all sizes to undefined but it didn't work.

In my layout and in my UI is no such word like setSizeFull() anymore. (searched)
I set the size to undefined.

I see the difference on the screen. But Vaadin still takes the control of the scrolling. I recognized it because the down button of the scrollbar doesn't work if Vaadin takes control of the scrollbar.
Is it possible that the use of customLayout interferes with this?

Can I see in the HTML if Vaadin takes the scroll control? Perhaps I can see with firebug where the bad element is.

Christian Wahl
9 years ago Aug 28, 2013 1:32pm
Thomas Mattsson
9 years ago Aug 29, 2013 11:26am
Bob Meier
8 years ago Jul 22, 2014 12:13pm

Hi,
Christian Wahl do you found a solution?

Jan Höck
8 years ago Dec 12, 2014 2:54pm
Panera Iñigo
8 years ago Mar 05, 2015 11:51am
Yevgen Dorozhko
7 years ago Jul 02, 2015 4:28pm

I have the save problems, and my workaround is:

private void setSizeUndefined2Print()
    {
        com.vaadin.ui.JavaScript.getCurrent().execute("document.body.style.overflow = \"auto\";" +
                                                      "document.body.style.height  = \"auto\"");
        UI.getCurrent().setSizeUndefined();
        this.setSizeUndefined();
    }

if for some cases you need to switch back to "defined" size, next function can be used:

private void setSizeFull2Print()
    {
        com.vaadin.ui.JavaScript.getCurrent().execute("document.body.style.overflow = \"\";" +
                                                      "document.body.style.height  = \"\"");
        UI.getCurrent().setSizeFull();
        this.setSizeFull();
    }