C#显示PDF文件 您所在的位置:网站首页 winform中预览pdf C#显示PDF文件

C#显示PDF文件

2023-12-06 12:04| 来源: 网络整理| 查看: 265

拖一个Adobe PDF ReaderC#显示PDF文件到窗体上, 双击窗体, 在窗体加载时, 弹出对话框, 加载PDFC#显示PDF文件: string fileName = MyOpenFileDialog(); axAcroPDF1.LoadFile(fileName);

MyOpenFileDialog()C#显示PDF文件为:         string MyOpenFileDialog()          {             OpenFileDialog ofd = new OpenFileDialog();              ofd.Filter = "PDF文档(*.pdf)|*.pdf";

            if (ofd.ShowDialog() == DialogResult.OK)              {                 return ofd.FileName;              }             else              {                 return null;              }          }

C#显示PDF文件C#显示PDF文件创建Adobe PDF Reader组件: string fileName = MyOpenFileDialog(); AxAcroPDFLib.AxAcroPDF axAcroPDF = new AxAcroPDFLib.AxAcroPDF(); axAcroPDF.Location = new System.Drawing.Point(0, 24); axAcroPDF.Size = new System.Drawing.Size(292, 242); axAcroPDF.Dock = DockStyle.Fill; Controls.Add(axAcroPDF); axAcroPDF.LoadFile(fileName);

不过要注意, 在C#显示PDF文件们把Adobe PDF Reader组件拖到窗体上白勺时候, 它会自动引用2个dll:AcroPDFLib和AcroPDFLib



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有