学无先后,达者为师

网站首页 编程语言 正文

Winform窗体中打开PDF文件的三种方式_C#教程

作者:springsnow   更新时间: 2022-08-05 编程语言

1、使用Adobe PDF Reader控件。

从COM组件库中找到Adobe PDF Reader控件,添加到工具箱中。

从工具箱中拖入PDF Reader控件。

可以看到VS自动添加了AxInterop.AcroPDFLib.dll跟Interop.AcroPDFLib.dll这两个组件。

使用代码加载PDF文件:

//axAcroPDF1.src="D:\\aa.pdf";
 axAcroPDF1.LoadFile("D:\\aa.pdf");

2、使用DevExpress控件中的pdfViewer控件

https://docs.devexpress.com/WindowsForms/9832/controls-and-libraries/pdf-viewer/examples/file-operations/how-to-load-a-pdf-document-from-a-file

this.pdfViewer1.LoadDocument(@"Report.pdf");

3、使用Spire.PdfViewer控件

https://www.e-iceblue.com/Introduce/free-pdf-viewer-net.html

免费版本:在查看和打印PDF文件时限于10页PDF。

从nuget下载Spire.PdfVie控件。

从工具箱拖入PdfViewer控件

自动引用了下面三个文件:

代码加载PDF文件

pdfViewer1.LoadFromFile("D:\\aa.pdf");

原文链接:https://www.cnblogs.com/springsnow/p/13305294.html

栏目分类
最近更新