在 WPF 应用程序中显示 PDF [英] Display a PDF in WPF Application

查看:34
本文介绍了在 WPF 应用程序中显示 PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何想法如何在 WPF Windows 应用程序中显示 PDF 文件?

Any ideas how to display a PDF file in a WPF Windows Application?

我使用以下代码运行浏览器,但 Browser.Navigate 方法没有做任何事情!

I am using the following code to run the browser but the Browser.Navigate method does not do anything!

WebBrowser browser = new WebBrowser();
browser.Navigate("http://www.google.com");
this.AddChild(browser); // this is the System.Windows.Window

推荐答案

糟糕.这是一个 winforms 应用程序.不适用于 WPF.无论如何我会发布这个.

Oops. this is for a winforms app. Not for WPF. I will post this anyway.

试试这个

private AxAcroPDFLib.AxAcroPDF axAcroPDF1;
this.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();
this.axAcroPDF1.Dock = System.Windows.Forms.DockStyle.Fill;
this.axAcroPDF1.Enabled = true;
this.axAcroPDF1.Name = "axAcroPDF1";
this.axAcroPDF1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axAcroPDF1.OcxState")));
axAcroPDF1.LoadFile(DownloadedFullFileName);
axAcroPDF1.Visible = true;

这篇关于在 WPF 应用程序中显示 PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆