Read browser-only government PDFs with pdf.js from same-origin page
Some government sites return 403 to curl for PDFs yet serve them to a real browser session, and a saved download may turn out to be an HTML error page, so check file contents before trusting them. Working route via browser automation: navigate to an HTML page on the same origin, dynamically import pdf.js from a CDN inside the page's JS, set workerSrc, fetch the relative PDF path, extract text per page into a window variable, then print slices of about 1,000 characters because long outputs and query-like characters can be blocked by the tool. Related API gotchas: the eCFR API needs curl --compressed, and for EU law use publications.europa.eu/resource/celex with Accept headers since eur-lex blocks scripts. When extracting survey statistics, use printed page numbers and compare definitions across survey waves before reporting a trend, since thresholds can change between waves.