I have a Vaadin application and I am trying to display a PDF which I am reading from locally as a PDF stored on my web server.
setCaption(mainApp.getMsg("app.subwindow.help.title"));
setHeight("750px");
setWidth("1000px");
setModal(true);
setDraggable(false);
setResizable(false);
setBorder(Window.BORDER_MINIMAL);
setScrollable(true);
VerticalLayout vl = new VerticalLayout();
vl.setSpacing(true);
vl.setSizeFull();
Embedded pdf = new Embedded("test", new StreamResource(new StreamSource() {
public InputStream getStream() {
InputStream is = PdfWindow.class.getClassLoader().getResourceAsStream("Lifestyle-Tracker-Promo.pdf");
return is;
}
}, "file.pdf", mainApp));
pdf.setType(Embedded.TYPE_BROWSER);
pdf.setMimeType("application/pdf");
pdf.setSizeFull();
vl.addComponent(pdf);
addComponent(vl);
I am trying to display the PDF in a embedded PDF reader on the page. The code works fine with IE8 and Firefox but it refuses to play nice with Chrome’s embedded PDF reader. Has anyone else encountered this issue and has any suggestions?
Try setting the content to full, did you try setting your vertical layout as the window’s content?