Winform在窗体上打开PDF文件进行查看

一、窗体上显示PDF的几种方法

1、使用Adobe PDF Reader控件。

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

image

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

image

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

image

使用代码加载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控件。

image

从工具箱拖入PdfViewer控件

image

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

image

代码加载PDF文件

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

posted on 2020-07-15 14:27  springsnow  阅读(4709)  评论(0编辑  收藏  举报

导航