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");


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM