VintaSoft Imaging .NET SDK 10.0
Vintasoft.Imaging.Pdf.Tree Namespace / PdfPageCollection Class
Members Example



In This Topic
    PdfPageCollection Class
    In This Topic
    Represents a collection of pages of PDF document.
    Object Model
    PdfPageCollection ClassPdfPage Class
    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:

    Instance of this class cannot be created directly, it can be received only from the Vintasoft.Imaging.Pdf.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 5; .NET Core 3.1; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also