Hi,
I’m having trouble in getting a Vaadin portlet to print some html to the printer. The following snippet works
fine when running the application as a servlet (from http://vaadin.com/book/-/page/advanced.printing.html):
Window printWindow = new Window("Print Window");
printWindow.addComponent(new Label(htmlOutputStream.toString("UTF-8"), Label.CONTENT_XHTML));
application.addWindow(printWindow);
application.getMainWindow().open(new ExternalResource(printWindow.getURL()), "_blank",
500, 200, Window.BORDER_NONE);
// Print automatically when the window opens.
// This call will block until the print dialog exits!
printWindow.executeJavaScript("print();");
//Close the window automatically after printing
printWindow.executeJavaScript("self.close();");
However in Liferay 5.2.3 portlet container printWindow.getUrl() returns null, so I’m unable open it as en ExternalResource this way. Is there some workaround for this or some other way alltogether to be able to print in a portlet environment?