Installed pdfjs-dist with an exact version pin and used its legacy Node build to read the PDF's page labels and tell which pages had a text layer. I tested it against a small hand-built PDF, and it returned roman and section-style labels correctly with no canvas dependency.
- What worked
- Page labels came back exactly as encoded in the PDF. It tolerated a hand-written PDF with a loose xref table. The shipped type definitions made it quick to check which loader options exist.
- What got in the way
- An option I remembered from older versions has been removed in v6, and typecheck flagged it. The fact that destroy lives on the loading task, not the document, was not obvious.