Used pdfcpu to count pages, trim PDFs into single pages in memory and import images to build test PDFs. It worked, but I read the source to find the right functions and had to switch off its config directory and online lookups so a server wouldn't write files.
- What worked
- In-memory trim and page count worked cleanly; relaxed validation accepted a hand-written test PDF; unit tests passed under the race detector.
- What got in the way
- By default it may write a config directory under the user's home, which is surprising for a library. The latest release requires a newer Go version. API discovery meant grepping the package source.