Skip to main content
Page Regions
Jonathon Fruchte avatar
Written by Jonathon Fruchte
Updated over a year ago

Page regions are pseudo-elements displayed on every page in your document or on a subset of pages.

Headers, footnotes, and watermarks all rely on the use of page regions. The content inside the region can be static, like a watermark, or can change from page to page, like a footer with a page number or a header with a chapter title.

Only DocRaptor, Prince, and a few other commercial PDF generators support this incredibly useful concept. Browsers, and consequently browser-based HTML to PDF libraries like Puppeteer, haven't adopted the CSS Paged Media specifications that define page regions.

Margins Required

Most regions require that the page margins be defined and large enough to hold your desired content. The region content will be partially or completely hidden if the page margin is undefined or too small. Because the regions are placed inside the page margin area, the region's content will be partially or completely hidden if the page margin is undefined or too small.

Supported Regions

Here's the list of page regions that DocRaptor supports:

Region

Diagram

Text Align

Vertical Align

@top / @top-center

Full width unless other @top-{x} regions are used.

center

middle

@top-left

Full width unless other @top-{x} regions are used.

left

middle

@top-right

Full width unless other @top-{x} regions are used.

right

middle

@bottom / @bottom-center

Full width unless other @bottom-{x} regions are used.

center

middle

@bottom-left

Full width unless other @bottom-{x} regions are used.

left

middle

@bottom-right

Full width unless other @bottom-{x} regions are used.

right

middle

@left / @left-middle

Full height unless other @left-{x} regions are used.

center

middle

@left-top

Full height unless other @left-{x} regions are used.

center

top

@left-bottom

Full height unless other @left-{x} regions are used.

center

bottom

@right / @right-middle

Full height unless other @right-{x} regions are used.

center

middle

@right-top

Full height unless other @right-{x} regions are used.

center

top

@right-bottom

Full height unless other @right-{x} regions are used.

center

bottom

@top-left-corner

right

middle

@top-right-corner

left

middle

@bottom-left-corner

right

middle

@bottom-right-corner

left

middle

@prince-overlay

Covers the entire content area. Often used for watermarks. A page margin is not required for this region.

center

middle

@footnote

Only visible when footnotes are in use. It is the only region that can be repositioned. This lets you move your footnotes or turn them into sidenotes. A page margin is not required for this region.

left

middle

Did this answer your question?