【教程】PDF组件Spire.PDF 教程:在C#中显示PDF文件的打印预览
生活随笔
收集整理的這篇文章主要介紹了
【教程】PDF组件Spire.PDF 教程:在C#中显示PDF文件的打印预览
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本文演示如何使用Spire.PDF和c#在Windows窗體應用程序中顯示PDF文件的打印預覽。
在使用下面的代碼之前,我們需要創建一個Windows窗體應用程序,在窗體中添加一個PrintPreviewControl控件,并將Spire.Pdf.dll引用到應用程序中。
using System; using System.Windows.Forms; using Spire.Pdf;namespace PreviewPDF {public partial class Form1 : Form{public Form1(){InitializeComponent();}private void printPreviewControl1_Click(object sender, EventArgs e){//Load PDF filePdfDocument pdf = new PdfDocument();pdf.LoadFromFile("New Zealand.pdf");//Set the PrintPreviewControl.Rows and PrintPreviewControl.Columns properties to show multiple pagesthis.printPreviewControl1.Rows = 2;this.printPreviewControl1.Columns = 2;//Preview the pdf filepdf.Preview(this.printPreviewControl1); } } }截圖:
總結
以上是生活随笔為你收集整理的【教程】PDF组件Spire.PDF 教程:在C#中显示PDF文件的打印预览的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何提高Bug敏感度
- 下一篇: ServiceHot ITSM助力天原集