Skip to content

earonesty/boxpdf](https:

v1.3.0 Breaking

This release includes 2 breaking changes for platform teams planning a safe upgrade.

Published 20d Build & Package
✓ No known CVEs patched
Read the diff → Tool health → What is this tool? →

✓ No known CVEs patched in this version

Topics

cloudflare-workers flexbox layout pdf pdf-lib typescript

Affected surfaces

breaking_upgrade

Summary

AI summary

Default page size changed from A4 to LETTER, with overflow warnings and helper utilities added.

Full changelog

Closes the page-size footgun that bit me writing the v1.2.0 demo (renderFlow defaulted to A4 while my constants assumed LETTER).

⚠️ Default page size changed: A4 → LETTER

`renderFlow` and `renderToPdf` now default to LETTER (612×792) to match pdf-lib (which boxpdf is built on). If you were relying on the A4 default, pass it explicitly:

```ts
await renderFlow(pdf, nodes, { size: PageSizes.A4 });
```

New helpers

Stop hardcoding `612 - 72`:

```ts
import { pageInner, pageContent, PageSizes } from "boxpdf";

const WIDTH = pageInner(PageSizes.Letter, 36); // 540
const { width, height } = pageContent(PageSizes.A4, 36);
```

Now your widths follow the page if you change `size` later.

Overflow warning

When a top-level child's measured width exceeds the page content area, you get a one-line warning at dev time:

```
[boxpdf] top-level vstack measured 540.0pt — exceeds page content area 523.3pt (A4 with 36pt margins). Pass {size: PageSizes.Letter} if that matches your intent, reduce the child's width, or add shrink/wrapping so it fits.
```

The warning fires from both `renderFlow` and `renderToPdf`. Suppress with `{warnings: false}` if you're deliberately overflowing.

Other surveys other PDF libs

We chose LETTER because:

| Lib | Default |
| --- | --- |
| pdf-lib (our base) | LETTER |
| @react-pdf/renderer | A4 |
| PDFKit | LETTER |
| jsPDF | A4 |
| Puppeteer | LETTER |

Defaults are genuinely split. Matching pdf-lib was the cleanest answer for a layout DSL sitting directly on top of it.

Tests

101/101 passing (12 new for page helpers + warning + LETTER default).

Breaking Changes

  • Default page size for renderFlow and renderToPdf changed from PageSizes.A4 to PageSizes.LETTER (612×792).
  • Code relying on the previous A4 default must now explicitly pass { size: PageSizes.A4 }.

Weekly OSS security release digest.

The CVE patches and breaking changes that affected production tools this week. One email, every Sunday.

No spam, unsubscribe anytime.

Share this release

Track earonesty/boxpdf](https:

Get notified when new releases ship.

Sign up free

About earonesty/boxpdf](https:

All releases →

Related context

Beta — feedback welcome: [email protected]