Maybe you can be more compatible if you implement a plugin using something like that:
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.HasSize;
import com.vaadin.flow.component.Tag;
import com.vaadin.flow.server.StreamResource;
@Tag("object")
public class PDFViewer extends Component implements HasSize {
public PDFViewer(StreamResource resource) {
this();
getElement().setAttribute("data", resource);
}
public PDFViewer(String url) {
this();
getElement().setAttribute("data", url);
}
private PDFViewer() {
getElement().setAttribute("type", "application/pdf");
setSizeFull();
}
}
I force to display using
StreamResource resource = new StreamResource("blah", () -> new ByteArrayInputStream(reportPDFBytes));
resource.setContentType("application/pdf");
resource.setCacheTime(0);
PDFViewer viewer = new PDFViewer(resource);
add(viewer);
On this case we dont have message, but you can implement creating a component more flexible,