在 GWT 应用程序中显示 PDF 文件

发布于 2024-12-23 00:22:39 字数 49 浏览 2 评论 0原文

我有一个PDF文件存储在服务器中,我想在客户端显示它。如何让pdf显示在需要的位置?

I have a PDF file stored in server and I want to display it on the client side. How can I make the pdf displayed in the required place?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

⊕婉儿 2024-12-30 00:22:39

您可以参考 PDF 文件创建框架小部件。 GWT 中的 Frame 小部件将在浏览器中呈现 HTML iFrame。

public class FrameExample implements EntryPoint {

  public void onModuleLoad() {
    // Make a new frame, and point it at Google.
    Frame frame = new Frame("http://www.mydomain.com/path to my pdf");

    // Add it to the root panel. or anywhere you want
    RootPanel.get().add(frame);
  }
}

You can create a frame widget with a reference to your PDF file. The Frame widget in GWT will render an HTML iFrame in your browser.

public class FrameExample implements EntryPoint {

  public void onModuleLoad() {
    // Make a new frame, and point it at Google.
    Frame frame = new Frame("http://www.mydomain.com/path to my pdf");

    // Add it to the root panel. or anywhere you want
    RootPanel.get().add(frame);
  }
}
思念满溢 2024-12-30 00:22:39

我用过以下。它工作正常。可能对你有用。

GWT 客户端:

HTML pdf = new HTML("<embed src='http://www.mydomain.com/path to my pdf' width='100%' height='500px'></embed>");
PDFPannel.add(pdf);

I have used following. Its working fine. May be its usefull for you.

GWT Client side:

HTML pdf = new HTML("<embed src='http://www.mydomain.com/path to my pdf' width='100%' height='500px'></embed>");
PDFPannel.add(pdf);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文