> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ploterr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Page sizes and frames

> Standard page sizes and the frame that goes around a sheet.

`pageSize` gives the width and the height of a standard page in millimetres. The other functions find formats and make the frame of a sheet.

## Import

```typescript theme={null}
import {
  pageSize,
  formatsIn,
  sizeMatchesFormat,
  sheetFrameFor,
  sheetFrameGeometry,
  PAGE_SPECS,
  PAGE_FAMILY,
} from '@opengeometry/floorkit';
```

## Example

```typescript theme={null}
import { pageSize, sizeMatchesFormat } from '@opengeometry/floorkit';

const portrait = pageSize('A4', 'portrait'); // 210 × 297 mm
const landscape = pageSize('A3', 'landscape'); // 420 × 297 mm
console.log(sizeMatchesFormat('A3', 'landscape', landscape)); // true
```

## Notes

* Landscape exchanges the width and the height.
* For a custom size, write the width and the height in the sheet.
* `sizeMatchesFormat` checks that a size agrees with its format.

## pageSize

Resolve a named format + orientation to width/height in millimetres.

```typescript theme={null}
function pageSize(format: Exclude<PageFormat, 'Custom'>, orientation: PageOrientation): PageSize;
```

## formatsIn

Formats in a family, largest first — the order a size picker lists them.

```typescript theme={null}
function formatsIn(family: PageFamily): Exclude<PageFormat, 'Custom'>[];
```

## sizeMatchesFormat

Whether a stored size agrees with the format and orientation it claims.

```typescript theme={null}
function sizeMatchesFormat(
  format: PageFormat,
  orientation: PageOrientation,
  size: PageSize,
  toleranceMm?: number,
): boolean;
```

## sheetFrameFor

Resolve a page to its frame.

```typescript theme={null}
function sheetFrameFor(page: PageSpec): SheetFrame;
```

## sheetFrameGeometry

The frame as drawable geometry, in absolute paper millimetres.

```typescript theme={null}
function sheetFrameGeometry(
  frame: SheetFrame,
  page: PageSpec,
): {
  lines: VectorLine[];
  texts: VectorText[];
};
```

## PAGE\_SPECS

Portrait dimensions in millimetres for each named format.

```typescript theme={null}
const PAGE_SPECS: Record<Exclude<PageFormat, 'Custom'>, PageSize>;
```

## PAGE\_FAMILY

The standard each format belongs to.

```typescript theme={null}
const PAGE_FAMILY: Record<Exclude<PageFormat, 'Custom'>, PageFamily>;
```

## Types

### PageFormat

Standard page sizes for paper space, in **millimetres** (portrait, width × height), with a **top-left** origin (x increases right, y increases down).

```typescript theme={null}
type PageFormat =
  | 'A0'
  | 'A1'
  | 'A2'
  | 'A3'
  | 'A4'
  | 'A5'
  | 'A6'
  | 'B0'
  | 'B1'
  | 'B2'
  | 'B3'
  | 'B4'
  | 'B5'
  | 'ANSI_A'
  | 'ANSI_B'
  | 'ANSI_C'
  | 'ANSI_D'
  | 'ANSI_E'
  | 'ARCH_A'
  | 'ARCH_B'
  | 'ARCH_C'
  | 'ARCH_D'
  | 'ARCH_E'
  | 'ARCH_E1'
  | 'Letter'
  | 'Legal'
  | 'Tabloid'
  | 'Custom';
```

### PageOrientation

```typescript theme={null}
type PageOrientation = 'portrait' | 'landscape';
```

### PageSize type

```typescript theme={null}
interface PageSize {
  width: number;
  height: number;
}
```

### PageFamily

Which standard a format belongs to — what a size picker groups by.

```typescript theme={null}
type PageFamily = 'ISO-A' | 'ISO-B' | 'ANSI' | 'ARCH' | 'US';
```

### SheetFrame

What a sheet's frame looks like, resolved to absolute paper millimetres.

```typescript theme={null}
interface SheetFrame {
  margins: SheetMargins;
  inner: FrameRect;
  drawBorder: boolean;
  centringMarks: boolean;
  zones?: SheetZones;
}
```

<ResponseField name="margins" type="SheetMargins" required />

<ResponseField name="inner" type="FrameRect" required>
  The rect the frame is stroked on, and that the title block anchors to.
</ResponseField>

<ResponseField name="drawBorder" type="boolean" required />

<ResponseField name="centringMarks" type="boolean" required />

<ResponseField name="zones" type="SheetZones" />

### SheetMargins

Inset from each page edge, in paper millimetres.

```typescript theme={null}
interface SheetMargins {
  left: number;
  top: number;
  right: number;
  bottom: number;
}
```

### FrameRect

Rectangle in paper millimetres.

The package does not export this type by name.

```typescript theme={null}
interface FrameRect {
  x: number;
  y: number;
  width: number;
  height: number;
}
```

### SheetZones

The zone reference grid along the border — how a drawing says "see B4".

```typescript theme={null}
interface SheetZones {
  columns: number;
  rows: number;
  bandMm: number;
}
```

<ResponseField name="columns" type="number" required />

<ResponseField name="rows" type="number" required />

<ResponseField name="bandMm" type="number" required>
  Depth of the labelled band, measured inwards from the page edge.
</ResponseField>

## Related

* [`PageSpec`](/floorkit/api/drawings/sheet-documents#pagespec)
* [`VectorLine`](/floorkit/api/drawings/draw-project-view#vectorline)
* [`VectorText`](/floorkit/api/drawings/draw-project-view#vectortext)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.