# Page Structure in PDF

Learn about the page structure of Wijmo's PDF module in this documentation topic

## Content

## 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.

![pdf-structure](https://cdn.mescius.io/document-site-files/images/3c7113e2-10b3-45ed-8f3b-9fb1e0af2b74/pdf-structure.743052.png)

Drawing areas are not isolated 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:

```javascript
import * as wijmo from '@mescius/wijmo';
import * as wjPdf from '@mescius/wijmo.pdf';

var doc = new wjPdf.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 wjPdf.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:

```javascript
var doc = new wjPdf.PdfDocument({
    pageSettings: {
        layout: wjPdf.PdfPageOrientation.Portrait,
        size: wjPdf.PdfPageSize.Letter,
        margins: {
            left: 72,
            top: 72,
            right: 72,
            bottom: 72
        }
    }
});
```

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

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

```javascript
doc.addPage(doc.currentPageSettings);
```