Skip to main content
All docs
V26.1
  • PdfDocument.Pages Property

    Obtains document pages.

    Namespace: DevExpress.Docs.Pdf

    Assembly: DevExpress.Docs.Pdf.v26.1.dll

    Declaration

    public PageCollection Pages { get; }

    Property Value

    Type Description
    PageCollection

    The page collection.

    Remarks

    The PDF Document API library supports the following page management actions:

    • Add new pages to a PDF document
    • Copy and reorder pages within a PDF document
    • Copy pages from one PDF document to another
    • Rotate and resize pages
    • Rotate, scale, and offset page content
    • Remove pages from a PDF document

    Refer to the following article for more information: New PDF Document API: Add, Reorder, and Remove Pages

    Example

    How to: Add a New Page to a PDF Document

    The following code snippet adds pages to a PDF document: one page at the end of the document and another page after the first page.

    using DevExpress.Docs.Pdf;
    using DevExpress.Drawing.Printing;
    using System.IO;
    
    using (PdfDocument pdfDocument = new PdfDocument(
        new FileStream(@"C:\Test Documents\Document.pdf", FileMode.Open, 
            FileAccess.ReadWrite)))
    {
        // Add pages to the end and at a specific position.
        pdfDocument.Pages.Add(DXPaperKind.A4);
        pdfDocument.Pages.Insert(1, new Page(DXPaperKind.Letter));
    
        pdfDocument.Save(new FileStream(@"C:\Test Documents\Document_upd.pdf", 
            FileMode.Create, FileAccess.Write));
    }
    
    See Also