Gets the number of pages in this PDFFile object.
public int GetPageCount()
Public Function GetPageCount() As Integer
public:
int GetPageCount();
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.
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Pdf
Imports Leadtools.WinForms
Imports Leadtools.Svg
Imports Leadtools.ImageProcessing
Public Sub PDFFilePageCountExample()
Dim pdfFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf")
' Show the number of pages
Dim file As PDFFile = New PDFFile(pdfFileName)
Dim pageCount As Integer = file.GetPageCount()
Console.WriteLine("File has {0} pages", pageCount)
End Sub
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls;
using Leadtools.Drawing;
using Leadtools.ImageProcessing;
using Leadtools.Pdf;
using Leadtools.Svg;
using Leadtools.WinForms;
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:\Users\Public\Documents\LEADTOOLS Images";
}
Products |
Support |
Feedback: GetPageCount Method - Leadtools.Pdf |
Introduction |
Help Version 19.0.2017.3.22
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.