【发布时间】:2020-03-11 01:55:11
【问题描述】:
有没有办法可以打开嵌入到组件中的 pdf 并发送到新的浏览器选项卡?
想法是将资源设置为此组件并在新选项卡中打开。稍后我将需要在更多按钮中导航不同的文档。
public class EmbeddedPdfDocument extends Component implements HasSize {
public EmbeddedPdfDocument(StreamResource resource) {
this();
getElement().setAttribute("data", resource);
}
public EmbeddedPdfDocument(String url) {
this();
getElement().setAttribute("data", url);
}
protected EmbeddedPdfDocument() {
getElement().setAttribute("type", "application/pdf");
setSizeFull();
}
}
【问题讨论】:
-
您的问题越来越不清楚。我怀疑你真的在问什么应该是两个单独的问题帖子。
-
我想我会尝试你在另一个问题上提到的这种方法。我将构建一个 UI 并通过参数加载它们。 stackoverflow.com/questions/51490046/…