Vaadin does not currently have any special support for printing. Printing on the server-side is, in any case, largely independent from the web UI of an application. You just have to take care that the printing does not block server requests, possibly by running printing in another thread.

For client-side printing, most browsers support printing the web page. Vaadin does not explicitly support launching the printing in browser, but you can easily use the JavaScript print() method that opens the print window of the browser.

final Button print = new Button("Print This Page");
print.addListener(new ClickListener() {
    public void buttonClick(ClickEvent event) {
        print.getWindow().executeJavaScript("print();");
    }
});

This button would print the current page, including the button itself. Often, you want to be able to print a report or receipt and it should not have any visible UI components. In such a case, you could offer it as a PDF resource, or you could open a new window, as is done below, and automatically launch printing.

// A button to open the printer-friendly page.
Button print = new Button("Click to Print");

print.addListener(new Button.ClickListener() {
	public void buttonClick(ClickEvent event) {
        // Create a window that contains what you want to print
        Window window = new Window("Window to Print");

        // Have some content to print
        window.addComponent(new Label(
                "<h1>Here's some dynamic content</h1>\n" +
                "<p>This is to be printed to the printer.</p>",
                Label.CONTENT_XHTML));

        // Add the printing window as a new application-level
        // window
        getApplication().addWindow(window);

        // Open it as a popup window with no decorations
        getWindow().open(new ExternalResource(window.getURL()),
                "_blank", 500, 200,  // Width and height 
                Window.BORDER_NONE); // No decorations

        // Print automatically when the window opens.
        // This call will block until the print dialog exits!
        window.executeJavaScript("print();");

        // Close the window automatically after printing
        window.executeJavaScript("self.close();");
    }
});

How the browser opens the window, as an actual (popup) window or just a tab, depends on the browser. Notice that calling the print() method in the window will block the entire application until the print dialog exits. After printing, we automatically close the window with another JavaScript call, as there is no close() method in Window.

Printing as PDF would not require creating a Window object, but you would need to provide the content as a static or a dynamic resource for the open() method. Printing a PDF file would obviously require a PDF viewer cabability (such as Adobe Reader) in the browser.