VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Tree Namespace / PdfPageCollection Class
Members Object Syntax Remarks Example Hierarchy Requirements SeeAlso
In This Topic
    PdfPageCollection Class
    In This Topic
    Represents a collection of pages of PDF document.
    Object Model
    PdfPage PdfPageCollection
    Syntax
    'Declaration
    
    <DefaultMemberAttribute("Item")>
    Public NotInheritable Class PdfPageCollection
    
    
    [DefaultMember("Item")]
    public sealed class PdfPageCollection
    
    
    [DefaultMember("Item")]
    public __gc __sealed class PdfPageCollection
    
    
    [DefaultMember("Item")]
    public ref class PdfPageCollection sealed
    
    
    Remarks

    Class allows to:

    • get an PdfPage object associated with selected page
    • add an VintasoftImage object as a PDF page to the PDF document
    • insert an VintasoftImage object as a PDF page into the PDF document
    • delete PDF page from the PDF document

    Instance of this class cannot be created directly, it can be received only from the PdfDocument object.

    Example

    Here is an example that shows how to add new blank pages to a PDF document:

    
    ''' <summary>
    ''' Adds a new empty page into PDF document.
    ''' </summary>
    ''' <param name="pdfFileName">The filename of PDF document.</param>
    ''' <param name="pageSize">The size of page.</param>
    Public Shared Sub AddEmptyPageToPdfDocument(pdfFileName As String, pageSize As System.Drawing.SizeF)
        ' open PDF document
        Using document As New Vintasoft.Imaging.Pdf.PdfDocument(pdfFileName)
            ' get the collection of pages of PDF document
            Dim pages As Vintasoft.Imaging.Pdf.Tree.PdfPageCollection = document.Pages
    
            ' add an empty page into collection of pages
            pages.Add(pageSize)
    
            ' save changes to a file
            document.SaveChanges()
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Adds a new empty page into PDF document.
    /// </summary>
    /// <param name="pdfFileName">The filename of PDF document.</param>
    /// <param name="pageSize">The size of page.</param>
    public static void AddEmptyPageToPdfDocument(string pdfFileName, System.Drawing.SizeF pageSize)
    {
        // open PDF document
        using (Vintasoft.Imaging.Pdf.PdfDocument document = 
            new Vintasoft.Imaging.Pdf.PdfDocument(pdfFileName))
        {
            // get the collection of pages of PDF document
            Vintasoft.Imaging.Pdf.Tree.PdfPageCollection pages = document.Pages;
    
            // add an empty page into collection of pages
            pages.Add(pageSize);
    
            // save changes to a file
            document.SaveChanges();
        }
    }
    
    

    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.Pdf.Tree.PdfPageCollection

    Requirements

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

    See Also