I have a Vaadin application and I am trying to display a PDF file that I read 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 a PDF in an embedded PDF reader on a page. The code works fine with IE8 and Firefox, but it refuses to play with Chrome's built-in PDF reader. Has anyone else encountered this problem and have any suggestions?
source share