# pageformat

    .pageformat side:{PageSide? = null} \
               pages:{Range? = null} \
                size:{PageSizeFormat? = null} \
         orientation:{PageOrientation = context.documentInfo.type.preferredOrientation} \
               width:{Size? = null} \
              height:{Size? = null} \
              margin:{Sizes? = null} \
           bordertop:{Size? = null} \
         borderright:{Size? = null} \
        borderbottom:{Size? = null} \
          borderleft:{Size? = null} \
         bordercolor:{Color? = null} \
          background:{Color? = null} \
             columns:{Int? = null} \
           alignment:{NodeStyle.TextAlignment? = null}
    -> Void

Content copied to clipboard

Sets the page layout format of the document. If a value is unset, the default value supplied by the underlying renderer is used.

- In case of `paged` documents, this function defines the properties of each page.

- In case of `slides` documents, this function defines the properties of each slide.

- In case of `plain` documents, this function defines some properties of the whole document, seeing it as just one page. Not all effects of this function are supported in plain documents.

This function can be called multiple times. Each call appends a new format layer, and later layers take priority over earlier ones. When side is specified, the format is scoped only to specific pages of `paged` documents, enabling distinct formatting per side (e.g. mirrored margins):

    .pageformat size:{A4}
    .pageformat side:{left} margin:{2cm 3cm 2cm 1cm}
    .pageformat side:{right} margin:{2cm 1cm 2cm 3cm}

Content copied to clipboard

If both size and width or height are set, the latter overrides the former. If both size and width or height are unset, the default value is used.

If any of bordertop, borderright, borderbottom, borderleft or bordercolor is set, the border will be applied around the content area of each page. If only bordercolor is set, the border will be applied with a default width to each side. Border is not supported in plain documents.

#### Parameters

side

- Optional
- Likely named

the page side this format applies to: `left` (verso) or `right` (recto). If unset, the format applies to all pages. Combinable with pages. Only supported in `paged` documents

#### Values

- `left`
- `right`

pages

- Optional

1-based inclusive range of page indices to restrict this format to (e.g. `2..5`). If unset, the format applies to all pages. Combinable with side. Only supported in `paged` documents

size

- Optional

standard size format of each page (overridden by width and height)

#### Values

- `a0`
- `a1`
- `a2`
- `a3`
- `a4`
- `a5`
- `a6`
- `a7`
- `a8`
- `a9`
- `a10`
- `b0`
- `b1`
- `b2`
- `b3`
- `b4`
- `b5`
- `letter`
- `legal`
- `ledger`

orientation

- Optional
- Likely named

orientation of each page. If not specified, the preferred orientation of the document type is used. Does not take effect if size is not specified.

#### Values

- `portrait`
- `landscape`

width

- Optional
- Likely named

width of each page

height

- Optional
- Likely named

height of each page

margin

- Optional
- Likely named

blank space around the content of each page. Not supported in slides documents

bordertop

- Optional

border width of the top content area of each page

borderright

- Optional

border width of the right content area of each page

borderbottom

- Optional

border width of the bottom content area of each page

borderleft

- Optional

border width of the left content area of each page

bordercolor

- Optional

color of the border around the content area of each page

background

- Optional

background color of each page

columns

- Optional
- Likely named

positive number of columns on each page. If set and greater than 1, the layout becomes multi-column. If < 1, the value is discarded

alignment

- Optional
- Likely named

text alignment of the content on each page

#### Values

- `start`
- `center`
- `end`
- `justify`

#### Throws

IllegalArgumentException

if pages is open-ended (has no finite end)

#### Wiki page

page-format