BrowserFrame and Microsoft Edge -> Missing PDF Viewer Toolbar!

Hello Vaadin friends,

I’m displaying pdf files in a BowserFrame. This works well for Chrome, Firefox and Internet Explorer. But in Edge the pdf viewer toolbar is not displayed which means that the pdf can not be printed. Normally the toolbar is shown after loading the pdf. Later it can be shown or hided by left mouse click or by using the context menu. But left mouse click does not work and the item “Show/Hide Toolbar” is not shown in the context menu.

I wrote this small sample program to isolate the problem. The problems comes up on both Vaadin7 and Vaadin 8.

package com.example.test;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.server.StreamResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.BrowserFrame;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@SuppressWarnings(“serial”)
@Theme(“test”)
public class TestUI extends UI
{

@WebServlet(value = "/*", asyncSupported = true)

@VaadinServletConfiguration(productionMode = false, ui = TestUI.class)
public static class Servlet extends VaadinServlet
{
}

@Override
protected void init(VaadinRequest request)
{
    final VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.setSizeFull();
    setContent(layout);
    
    StreamResource.StreamSource s = new StreamResource.StreamSource() {

        public InputStream getStream()
        {
            try
            {
                  File f = new File("c:/test.pdf");
                  FileInputStream fis = new FileInputStream(f);
                  return fis;
            }
            catch (Exception e)
            {
                e.printStackTrace();
                return null;
            }
        }
    };

    StreamResource r = new StreamResource(s, "test.pdf");
    r.setMIMEType("application/pdf");

    BrowserFrame browserFrame = new BrowserFrame();
    browserFrame.setSizeFull();
    browserFrame.setSource(r);        
    
    layout.addComponent(browserFrame);
}

}

Any idea how to fix this?

Thanks
Rolf

Not helping, but if I understand correctly, this is because Edge supports displaying PDFs natively, so it’s not using Acrobat or whetever else you are using in other browsers. I’m not aware of a way around this.