# `PaperSize`

A paper size: `A4`, `Letter` and so on.

Use it for printing and PDFs.

## Shape

One of these 25 values:

| Value | Written |
|---|---|
| `PaperSize.a0` | `A0` |
| `PaperSize.a1` | `A1` |
| `PaperSize.a2` | `A2` |
| `PaperSize.a3` | `A3` |
| `PaperSize.a4` | `A4` |
| `PaperSize.a5` | `A5` |
| `PaperSize.a6` | `A6` |
| `PaperSize.a7` | `A7` |
| `PaperSize.a8` | `A8` |
| `PaperSize.a9` | `A9` |
| `PaperSize.a10` | `A10` |
| `PaperSize.b0` | `B0` |
| `PaperSize.b1` | `B1` |
| `PaperSize.b2` | `B2` |
| `PaperSize.b3` | `B3` |
| `PaperSize.b4` | `B4` |
| `PaperSize.b5` | `B5` |
| `PaperSize.b6` | `B6` |
| `PaperSize.b7` | `B7` |
| `PaperSize.b8` | `B8` |
| `PaperSize.b9` | `B9` |
| `PaperSize.b10` | `B10` |
| `PaperSize.letter` | `Letter` |
| `PaperSize.legal` | `Legal` |
| `PaperSize.tabloid` | `Tabloid` |

## Example

```jadpo
PaperSize.a4
```

`text.parse(raw, as: PaperSize)` reads one from text that comes from outside. Text that isn't one at all fails `malformed`, such as `A11`, `C4` or `Executive`.

## Good to know

- `==` tells you whether two are the same. `<` and `list.sort_by` don't take it.

## In JSON

A string, in a request, a response or `json.write`:

```json
"A4"
"B5"
"Letter"
```

## Details

<details>
<summary>Text form, storage, how it is shown, and operations</summary>

`PaperSize` is in the group Media and visual, and has been in Jadpo since 0.1.0.

### Text form

`text.from` writes one standard text form, the same form `text.parse` reads back: `A4`, `B5` and `Letter`.

### How it is stored

It is stored in one column named for the field, of type `text`. `B5` is stored as `'B5'`.

### How it is shown to people

`text.format(value, locale:)` shows it to people in their locale.

With `locale: Locale.en_gb`:

| Value | Shown |
|---|---|
| `A4` | `A4` |
| `B5` | `B5` |
| `Letter` | `Letter` |

### Operations

It also takes `text.parse`, `text.from`, `text.format`, `json.read`, `json.write` and `==`. [How every standard type behaves](/docs/every-standard-type-meets-one-contract.md) says how they work.

</details>
