### Page structure

This sample shows the page structure of a PdfDocument.

#### Page sections

In PdfDocument, each page is divided into three sections: header, body and footer. Each of these sections denotes a drawing area, represented by the PdfPageArea class, with its own methods for drawing text and graphics. Drawing areas are notisolated from each other, so the drawings made in one area might affect another one.

Each of the drawing areas has its own coordinate system, where (0, 0) coordinate points to the upper-left corner.

The PdfDocument class instance represents the body section itself, while its header and footer properties represent the header and footer sections respectively:

    var doc = new wijmo.pdf.PdfDocument();

    doc.header.drawText("header");
    doc.drawText("body");
    doc.footer.drawText("footer");

To hide footer or header set the area's height property to 0.

    var doc = new wijmo.pdf.PdfDocument({
        header: { height: 0 },
        footer: { height: 0 }
    });

#### Page settings

During initialization, you can define page settings such as layout, size and margins by passing them into PdfDocument's constructor within pageSettings object.

- The layout determines the orientation of the page, portrait or landscape.
- The size determines the dimensions of the page. Both predefined and custom sizes are supported.
- The margins determines the margins of the page.

For example:

    var doc = new wijmo.pdf.PdfDocument({
        pageSettings: {
            layout: wijmo.pdf.PdfPageOrientation.Portrait,
            margins: {
                left: 72,
                top: 72,
                right: 72,
                bottom: 72
            }
        }
    });

None of these settings can be changed at run-time for already existing pages.

Use doc.pageSettings property to provide settings for the pages that will be added automatically or by calling doc.addPage method. Use doc.currentPageSettings property to get the current page settings.

In this sample, layout, size and margins properties are declared explicitly. Each page section is stroked for clarification purposes.