Page formats constants
The PAGE_FORMATS constant provides a set of predefined page formats (such as A4, A3, Letter, etc.) with real-world dimensions and recommended margins, already converted to pixels. This is useful for quickly setting up the pageFormat option or custom layouts in the Tiptap Pages extension.
Import
import { PAGE_FORMATS } from '@tiptap-pro/extension-pages'API
PAGE_FORMATS: {
[format: string]: {
id: string
width: number // in pixels
height: number // in pixels
margins: {
top: number
right: number
bottom: number
left: number
}
}
}Available Formats
Pixel values use standard CSS pixels (one inch is 96 pixels). The constants preserve fractional pixel precision internally; the integers below are rounded for readability.
| Format | Width (px) | Height (px) | Margins (px: top / right / bottom / left) |
|---|---|---|---|
| A4 | 794 | 1123 | 95 / 76 / 95 / 76 |
| A3 | 1123 | 1587 | 95 / 76 / 95 / 76 |
| A5 | 559 | 794 | 76 / 57 / 76 / 57 |
| Letter | 816 | 1056 | 96 / 96 / 96 / 96 |
| Legal | 816 | 1345 | 96 / 96 / 96 / 96 |
| Tabloid | 1056 | 1633 | 96 / 96 / 96 / 96 |
For the underlying real-world measurements in centimetres, see Page format.