窗体上显示PDF
方法一:使用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");
方法二:使用DevExpress控件中的pdfViewer控件
this.pdfViewer1.LoadDocument(@"Report.pdf");
方法三:使用Spire.PdfViewer控件
https://www.e-iceblue.com/Introduce/free-pdf-viewer-net.html
从nuget下载Spire.PdfVie控件。
从工具箱拖入PdfViewer控件
自动引用了下面三个文件:
代码加载PDF文件
pdfViewer1.LoadFromFile("D:\aa.pdf");