【问题标题】:View PDF File using Windows Form C# from Remote URL从远程 URL 使用 Windows Form C# 查看 PDF 文件
【发布时间】:2022-01-27 01:39:46
【问题描述】:

我正在寻找解决方案,我想从远程服务器/url 在 Windows 窗体 C# 上查看 pdf 文件。

这可行吗?

【问题讨论】:

  • 是的,这是可行的
  • WebView2无需任何插件即可显示PDF内容。这就是你所需要的。 -- 该控件替代了旧的 WebBrowser 控件;适用于 Windows 7+ 系统。

标签: c# winforms pdf


【解决方案1】:

看看这个。我正在使用 DevExpress 的 PDF Viewer 控件在应用程序中显示 PDF 文档。

using System.Net;

string Url = "YOUR_URL";
using(WebClient client = new WebClient()) {
    using(MemoryStream ms = new MemoryStream(client.DownloadData(Url))) {
        pdfViewer1.LoadDocument(ms);
    }
}

【讨论】:

    【解决方案2】:

    在使用 Windows 时,您应该使用原生 PDF 引擎获得最一致的支持,从 Windows 7(但作为 EOL 折旧)到 11 是 MSEdge,它可以集成到 WebView 2 中

    查看入门和示例代码的最佳位置是

    https://docs.microsoft.com/en-us/microsoft-edge/webview2/code-samples-links#sample-code-for-get-started-guides

    github位置是

    https://github.com/MicrosoftEdge/WebView2Samples

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多