Print Content more than one page..?

I want to print a window in multiple pages…below is my code… but it is printing first page

public class WindowComp extends CustomComponent {

/*- VaadinEditorProperties={"grid":"RegularGrid,20","showGrid":true,"snapToGrid":true,"snapToObject":true,"movingGuides":false,"snappingDistance":10} */

private VerticalLayout mainLayout;
private VerticalLayout verticalLayout_7;
private static VerticalLayout vlWindows;
private Panel panel_14;
private VerticalLayout verticalLayout_18;
private Panel panel_13;
private VerticalLayout verticalLayout_17;
private Panel panel_12;
private VerticalLayout verticalLayout_16;
private Panel panel_11;
private VerticalLayout verticalLayout_14;
private Panel panel_10;
private VerticalLayout verticalLayout_13;
private HorizontalLayout horizontalLayout_2;
private Button btnPrint;
private static final long serialVersionUID = 6568071254511464649L;
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 * The constructor will not be automatically regenerated by the
 * visual editor.
public WindowComp() {

private void addComponentsEventHandlers() {
    // Add print buttton change listener.
            btnPrint.addClickListener(new ClickListener() {
                private static final long serialVersionUID = 3443163114334805003L;
                public void buttonClick(ClickEvent event) {

// printBrowser();

protected void printwindow() {
    final Window window = new Window("Window  REPORT");
    JavaScript.getCurrent().execute("setTimeout(function() {" + " print(); self.close();}, 100);");

private void printBrowser() {
     BrowserWindowOpener opener = new BrowserWindowOpener(PrintUI.class);

public static class PrintUI  extends UI{
    private static final long serialVersionUID = 2944723925173168186L;
    protected void init(VaadinRequest request) {
                // Have some content to print
                // Print automatically when the window opens
                    "setTimeout(function() {" +
                    "  print(); self.close();}, 1000);");                                    


Has anyone come up with a solution for this?

I found a way to
print multiple pages from Vaadin 7

I followed the Vaadin 7 example for printing a simple HTML report

This works but only prints the first page.

I found the following ‘style’ tag on the header of the Vaadin HTML who is the responsible for this behavior

[font=courier new]

... [color=#FF0000] html, body {height:100%;margin:0;} [/color] ... ... [/font]

So the workaround to avoid this is
override the style
You can achieve this including an inline Javascript on the body of the page like this:

[font=courier new]

html, body {height:initial;margin:initial;}


I am afraid that the ‘style scoped’ tag belongs to HTML 5.

Hope this helps.

I have achieved the same result by simply calling setHeight(null) on the UI. The downside of both of these solutions is that you will lose the ability to scroll the page, so it will be usable only for printing purposes.

Try workaround here:!/thread/3869543/3869542