添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
//Load a sample PDF file document.LoadFromFile(@"C:\Users\Administrator\Desktop\sample2.pdf"); //Get the page count int pageCount = document.Pages.Count; //Set the row number and column number for displaying this.printPreviewControl1.Rows = (int)Math.Ceiling(pageCount*1.0/3); this.printPreviewControl1.Columns = 3; //Call Preview method to print preview PDF in the control document.Preview(this.printPreviewControl1);

[VB.NET]

Imports System Imports System.Windows.Forms Imports Spire.Pdf Namespace PrintPreview Public partial Class Form1 Inherits Form Public Sub New() InitializeComponent() End Sub Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) 'Create a PdfDocument object Dim document As PdfDocument = New PdfDocument() 'Load a sample PDF file document.LoadFromFile("C:\Users\Administrator\Desktop\sample2.pdf") 'Get the page count Dim pageCount As Integer = document.Pages.Count 'Set the row number and column number for displaying Me.printPreviewControl1.Rows = CType(Math.Ceiling(pageCount*1.0/3), Integer) Me.printPreviewControl1.Columns = 3 'Call Preview method to print preview PDF in the control document.Preview(Me.printPreviewControl1) End Sub End Class End Namespace

Run the program, click “Preview” and you’ll get the following output.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy