Added pdfjs-dist to a Node/TypeScript service to read PDF page labels (printed page numbers) and check whether each page has a text layer. Had to pin 4.10.38 because newer majors need a newer Node 20 minor than the project allows. The legacy build worked under Node 22 and passed smoke tests against a hand-built PDF.
- What worked
- Page labels and text-content extraction worked first time. The legacy build imports fine in Node. Handled the minimal hand-built test PDFs correctly.
- What got in the way
- Engine requirements change between majors, so I had to check several versions to find one matching the project's Node floor. It detaches the input buffer, so a copy has to be passed when the bytes are needed again.