←Select platform

PageNumber Property

Summary
Number of this PDF page.
Syntax
C#
C++/CLI
Java
Python
public int PageNumber { get; set; } 
public int getPageNumber(); 
public void setPageNumber( 
   int intValue 
); 
public: 
property int PageNumber { 
   int get(); 
   void set (    int ); 
} 
PageNumber # get and set (PDFFilePage) 

Property Value

A System.Int32 that specifies the number of this page. The default value is 0.

Remarks

Each item in the PDFFile.Pages collection corresponds to a page in the PDF file. So item at index 0 is the properties of page 1, item at index 1 is the properties of page 2 and so on. Even though the PDFFilePage structure contains the PageNumber property that specifies the number of the page, this information is for convenience only, the PDFFile.Load will always populate the collection in the correct order from first page to last page.

Example
C#
Java
using Leadtools.WinForms; 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.Pdf; 
using Leadtools.Svg; 
 
 
public void PDFFilePagesExample() 
{ 
   string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf"); 
 
   // Load the file 
   PDFFile file = new PDFFile(pdfFileName); 
   file.Load(); 
 
   // Show the pages 
   Console.WriteLine("File has {0} pages", file.Pages.Count); 
   foreach (PDFFilePage page in file.Pages) 
   { 
      Console.WriteLine("Page {0} size is {1} by {2} units", page.PageNumber, page.Width, page.Height); 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.ByteArrayInputStream; 
import java.io.File; 
import java.io.FileInputStream; 
import java.io.FileNotFoundException; 
import java.io.FileOutputStream; 
import java.io.FileReader; 
import java.io.IOException; 
import java.io.InputStream; 
import java.nio.file.Files; 
import java.nio.file.Paths; 
import java.nio.file.StandardCopyOption; 
import java.util.ArrayList; 
import java.util.Date; 
import java.util.List; 
import java.util.Scanner; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.pdf.*; 
 
 
public void pdfFilePagesExample() { 
 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   String pdfFileName = combine(LEAD_VARS_IMAGES_DIR, "Leadtools.pdf"); 
 
   // Load the file 
   PDFFile file = new PDFFile(pdfFileName); 
   file.load(); 
 
   // Show the pages 
   System.out.printf("File has %d pages%n", file.getPageCount()); 
   for (PDFFilePage page : file.getPages()) { 
      System.out.printf("Page %d size is %f by %f units%n", page.getPageNumber(), page.getWidth(), page.getHeight()); 
   } 
   assertTrue(file.getPages().size() == 5); 
 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Pdf Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.