VintaSoft Imaging .NET SDK 15.2: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Tree Namespace / PdfPageCollection Class / Count Property
Syntax Example Requirements SeeAlso
In This Topic
Count Property (PdfPageCollection)
In This Topic
Gets the number of pages contained in the collection.
Syntax
'Declaration

Public ReadOnly Property Count As System.Int32

public System.Int32 Count { get; }

Example

Here is an example that shows how to get the count of pages in PDF document:


''' <summary>
''' Returns the number of pages in PDF document.
''' </summary>
''' <param name="pdfFileName">The filename of PDF document.</param>
Public Shared Function GetPagesCount(pdfFileName As String) As Integer
    ' open PDF document
    Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFileName)
        ' get the number of pages
        Dim pagesCount As Integer = document.Pages.Count

        ' return number of pages
        Return pagesCount
    End Using
End Function


/// <summary>
/// Returns the number of pages in PDF document.
/// </summary>
/// <param name="pdfFileName">The filename of PDF document.</param>
public static int GetPagesCount(string pdfFileName)
{
    // open PDF document
    using (Vintasoft.Imaging.Pdf.PdfDocument document = 
        new Vintasoft.Imaging.Pdf.PdfDocument(pdfFileName))
    {
        // get the number of pages
        int pagesCount = document.Pages.Count;
        
        // return number of pages
        return pagesCount;
    }
}

Requirements

Target Platforms: .NET 11; .NET 10; .NET 9; .NET 8; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also