Skip to main content
All docs
V26.1
  • PageCollection.Add(DXPaperKind) Method

    Adds a page with the specified paper size to the collection.

    Namespace: DevExpress.Docs.Pdf

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

    Declaration

    public Page Add(
        DXPaperKind kind
    )

    Parameters

    Name Type Description
    kind DXPaperKind

    The page size.

    Returns

    Type Description
    Page

    The added page.

    Example

    How to: Add Pages 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