←Select platform

LastPageNumber Property

Summary
Gets or sets the 1-based index of the last page associated with this PDFPageRange.
Syntax
C#
C++/CLI
Java
Python
public int LastPageNumber { get; set; } 
public int LastPageNumber; 
public: 
property int LastPageNumber; 
LastPageNumber (PDFPageRange) 

Property Value

An integer number indicating the last page to merge using PDFFile.MergeFiles. You can set this value to -1, which indicates the last page in the file. Otherwise, this value should be greater than or equal to PDFPageRange.FirstPageNumber.

Remarks

The first page to merge is indicated by PDFPageRange.FirstPageNumber.

This property indicates the last page that would be merged. So, if you wish to merge pages 1 and 2, set PDFPageRange.FirstPageNumber to 1 and LastPageNumber to 2.

If you wish to merge only one page (for example 3), you would set PDFPageRange.FirstPageNumber and LastPageNumber to 3.

Example

C#
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 MergeFiles() 
{ 
 
   // This example will extract two pages from the current file and one page from another (encrypted) file into a single output file. 
   // All the pages in the output file will be unencrypted. 
   string srcFile = Path.Combine(LEAD_VARS.ImagesDir, "leadtools.pdf"); 
   string dstFile = Path.Combine(LEAD_VARS.ImagesDir, "leadtools 4-5 1.pdf"); 
   PDFFile pdfFile = new PDFFile(srcFile); 
   PDFPageRange[] srcPages = new PDFPageRange[2]; 
 
   srcPages[0].FirstPageNumber = 4; 
   srcPages[0].LastPageNumber = 5; 
   /* Leave srcPages[0] set to null, so pages 4 and 5 are extracted from leadtools.pdf */ 
 
   srcPages[1].FileName = Path.Combine(LEAD_VARS.ImagesDir, "Encrypted.pdf"); // Encrypted.pdf file must exist. If none exists, provide one. 
   srcPages[1].Password = "LEAD"; 
   srcPages[1].FirstPageNumber = 1; 
   srcPages[1].LastPageNumber = 1; 
 
   pdfFile.MergeFiles(srcPages, dstFile); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 

Requirements

Target Platforms

See Also

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

Leadtools.Pdf Assembly

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