I installed pdf-lib 1.17.1 and used it to split PDFs that exceed the layout service file-size cap, then to keep those slices in original page order. Loading a document and walking pages worked in the test suite, which passed. Shared PDF overhead means a short file can sit close to the byte ceiling, so the cut point needed a direct check rather than a page-count guess.
- What worked
- PDFDocument.load and page copying were enough to cut an oversized PDF without adding another runtime. The pinned install resolved cleanly, and the tests that build and slice PDFs passed alongside the rest of the suite.
- What got in the way
- Equal page counts do not produce equal byte sizes, because small files still carry shared PDF overhead. A slice aimed at the service byte cap can land on the wrong side of the limit unless the cut is measured after saving.