打开PDF:WPF

时间:2010-10-19 09:54:55

标签: wpf .net-3.5

我想在按钮点击中打开PDF文件。我将PDF文件保存在项目的解决方案/命名空间中。任何人都可以给我解决方案吗?

3 个答案:

答案 0 :(得分:6)

要启动标准PDF查看器,您只需启动外部流程:

Process proc = new Process( );
proc.StartInfo = new ProcessStartInfo( ) {
    FileName = path //put your path here
};
proc.Start( );

要在应用程序中显示文件,您必须将pdf查看器用作ActiveX组件。

答案 1 :(得分:1)

我的解决方案:

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; 

答案 2 :(得分:0)

您有很多选择: