# PDF size tools: reproducible examples

Reviewed 5 September 2026. Chrome 152.0.7977.83; PDF.js 4.8.69; pdf-lib 1.17.1. Synthetic source with shared selectable text, a 90-degree rotated page, and a seeded noisy color chart. No personal information.

Run from webapp with Node 22: `node scripts/benchmark-pdf-size-tools.mjs`. Default writes tests/ui/output/pdf-size-tools-benchmark. Use `--publish` deliberately to update these files. Chrome and access to the site's pinned pdf-lib CDN are required. Original source geometry, seed and metadata dates are fixed. Actual PDF/JPEG bytes can vary with browser or library versions; hashes describe these published files.

JPG cases check 50,000 bytes per selected page with automatic dimensions, plus a deliberately impossible 100-byte limit at fixed starting dimensions. Split cases check 2,000 and 400,000 bytes per serialized PDF. The 2,000-byte case includes a single oversized chart page; it is returned intact and fails. PDF.js independently decodes output page order, required selectable text, dimensions and rotation. PNG previews render every copied page in the 2,000-byte case for visual review.

The algorithms measure final files, not source-size ratios or ZIP bytes. Passing size does not establish readability, upload acceptance, or preservation of document-level features. Source and engine hashes, settings, pass/fail checks, and per-page text checks are in [benchmark.json](benchmark.json).

## Files

- [source.pdf](source.pdf): 310,814 bytes; SHA-256 `06df9843bc9202cdb6ebf6c2417428e5ee4355ede2af887275408f31121a8e7f`
- [jpg-50kb-page-1.jpg](jpg-50kb-page-1.jpg): 49,665 bytes; SHA-256 `4f2ca0b7566c082359ae591262a1ffbf22d964edda8a0c24c580871cf7d9bf98`
- [jpg-50kb-page-2.jpg](jpg-50kb-page-2.jpg): 49,561 bytes; SHA-256 `7f1cf6137b36b97df8ca419a42b668720e537c149945093b2a62c0f804975373`
- [jpg-50kb-page-4.jpg](jpg-50kb-page-4.jpg): 48,170 bytes; SHA-256 `dee340ebce57c8c02e8490128db58bdd523512223753d5af71ec6997c1c9a2c1`
- [jpg-impossible-page-4.jpg](jpg-impossible-page-4.jpg): 16,177 bytes; SHA-256 `c6d54ec4448445150bf6e387ee52ad41ab7bb7b9b01047c3f2b66f39de23cbe1`
- [split-preview-page-1.png](split-preview-page-1.png): 54,779 bytes; SHA-256 `1be962820432f4a55bc1de4db432b87c66d8a7cacbdb6ebf1e183502c18c8923`
- [split-2kb-pages-1-1.pdf](split-2kb-pages-1-1.pdf): 1,277 bytes; SHA-256 `6c224cf5e78eafded3be25464a84e76f6b788c3be4f5dc9400a11deda4436e0d`
- [split-preview-page-2.png](split-preview-page-2.png): 30,225 bytes; SHA-256 `9e4cdd4118c5d4f4f3611e7b5292016b30a19c65d72b8d4b7ce1e671e5554f24`
- [split-2kb-pages-2-2.pdf](split-2kb-pages-2-2.pdf): 1,269 bytes; SHA-256 `7f501117f31c2054e14e3d497ba0da215eec8647849f27590b93323e6dc672b2`
- [split-preview-page-3.png](split-preview-page-3.png): 54,610 bytes; SHA-256 `c4715e2a3e7070a8cb509b88620d998eb99948001085313f8f1bf35204401807`
- [split-2kb-pages-3-3.pdf](split-2kb-pages-3-3.pdf): 1,270 bytes; SHA-256 `e47034b44f7b09156048a246be9b3595a87903457fab638de9f7ec6b68bc6cb7`
- [split-preview-page-4.png](split-preview-page-4.png): 440,907 bytes; SHA-256 `3ebac237fb2357678cd7cfa9749c78020bbbd26c67531deb1174631e23dcfd08`
- [split-2kb-pages-4-4.pdf](split-2kb-pages-4-4.pdf): 308,425 bytes; SHA-256 `13e09af12fce77a78c869de28947dc072f23e9ddf5b31a4d37b311d73e9354b9`
- [split-400kb-pages-1-4.pdf](split-400kb-pages-1-4.pdf): 310,670 bytes; SHA-256 `1d640fd941ec76246eaeb63654a94dbd04a640a41406a5b5e16ee0afa316e52e`

## Reuse

JPEGConvert dedicates the original synthetic source fixture, generated JPG/PDF/PNG results, and measurements in this directory to the public domain under [CC0 1.0](https://creativecommons.org/publicdomain/zero/1.0/). This dedication does not change the licenses of PDF.js, pdf-lib, fonts, or browser software.

## Technical references

- [PDF.js viewport and page rendering](https://mozilla.github.io/pdf.js/examples/)
- [pdf-lib copyPages and save](https://pdf-lib.js.org/docs/api/classes/pdfdocument)
- [pdf-lib save options](https://pdf-lib.js.org/docs/api/interfaces/saveoptions)
