public int GetPageCount()
public int getPageCount();
public:
int GetPageCount();
def GetPageCount(self):
A System.Int32 that represents the number of pages in this PDFFile object.
This method will obtain the number of pages in the PDF file set in FileName. Since obtaining the number of pages might require decrypting a secured file, the value of the password set in Password will be used if the file is encrypted.
To get the size of each page in a PDF file, use the Load method which populates the Pages collection with an PDFFilePage for each page.
This method is faster than calling Load and using Pages.Count since it does not parse the page sizes not load the document properties.
This example will return the number of pages inside a PDF file.
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 PDFFilePageCountExample()
{
string pdfFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf");
// Show the number of pages
PDFFile file = new PDFFile(pdfFileName);
int pageCount = file.GetPageCount();
Console.WriteLine("File has {0} pages", pageCount);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document