在使用下面的代码之前,我们需要创建一个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 file PdfDocument pdf = new PdfDocument(); pdf.LoadFromFile("New Zealand.pdf"); //Set the PrintPreviewControl.Rows and PrintPreviewControl.Columns properties to show multiple pages this.printPreviewControl1.Rows = 2; this.printPreviewControl1.Columns = 2; //Preview the pdf file pdf.Preview(this.printPreviewControl1); } }}
截图:

标签:文档管理PDF
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!