{"_id":"@happyvertical/pdf","_rev":"10-baf5ac228b5d98ef6a1aaa9f7635507f","name":"@happyvertical/pdf","dist-tags":{"latest":"0.67.2"},"versions":{"0.65.2":{"name":"@happyvertical/pdf","version":"0.65.2","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"license":"MIT","_id":"@happyvertical/pdf@0.65.2","maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"homepage":"https://github.com/happyvertical/pdf#readme","bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"dist":{"shasum":"d27edd264f8ed7859e96fcf5771e3a991f25e9ad","tarball":"https://registry.npmjs.org/@happyvertical/pdf/-/pdf-0.65.2.tgz","fileCount":53,"integrity":"sha512-qbXcEiD4ubQ/xwzONqpviFgIinPJvgf3+wKEDb4/BD0FygVT0sJeOxqywDkkeN9KOthAew3AiT3FhJkErXcEFA==","signatures":[{"sig":"MEYCIQDjdWK9+qGYhR3Qn/jD9Yqzp0Dmj2zVNQxk3ztPNvBDvwIhALMrmH0MEf4QArvSAupu8PhmtEoamy4bGCfsbt15WdJ9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":464861},"main":"./dist/index.js","type":"module","_from":"file:happyvertical-pdf-0.65.2.tgz","types":"./dist/index.d.ts","engines":{"node":">=24","pnpm":">=9"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"npm run build:watch & npm run test:watch","lint":"biome check .","test":"vitest run --testTimeout 120000","build":"vite build","clean":"rm -rf dist *.tsbuildinfo","format":"biome format --write src/","docs:api":"typedoc --options typedoc.json","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest --testTimeout 120000","build:watch":"vite build --watch","test:coverage":"vitest run --coverage --testTimeout 120000","changeset:auto":"npx tsx scripts/auto-changeset.ts","docs:api:check":"tsx scripts/check-generated-api-docs.ts","changeset:publish":"changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"wllgrffn","email":"willgriffin@gmail.com"},"_resolved":"/tmp/e63bcf9b2ff27057ec7aaf84661715c1/happyvertical-pdf-0.65.2.tgz","_integrity":"sha512-qbXcEiD4ubQ/xwzONqpviFgIinPJvgf3+wKEDb4/BD0FygVT0sJeOxqywDkkeN9KOthAew3AiT3FhJkErXcEFA==","repository":{"url":"git+https://github.com/happyvertical/pdf.git","type":"git"},"_npmVersion":"11.16.0","description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","directories":{},"_nodeVersion":"24.18.0","dependencies":{"unpdf":"^1.4.0","marked":"^14.1.4","pdf-lib":"^1.17.1","pdfjs-dist":"5.4.296","puppeteer-core":"^25.1.0","@napi-rs/canvas":"0.1.99","@happyvertical/ocr":"^0.60.52","@happyvertical/utils":"^0.74.9"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.0","vite":"7.3.2","vitest":"^4.0.8","typedoc":"^0.28.19","lefthook":"^1.11.13","typescript":"^5.9.3","@types/node":"24.12.2","@biomejs/biome":"1.9.4","@changesets/cli":"^2.29.8","@commitlint/cli":"^19.8.1","vite-plugin-dts":"4.5.4","@vitest/coverage-v8":"^4.0.15","@commitlint/config-conventional":"^19.8.1"},"optionalDependencies":{"@kreuzberg/node":"^4.1.1"},"_npmOperationalInternal":{"tmp":"tmp/pdf_0.65.2_1782292267962_0.019121009651530407","host":"s3://npm-registry-packages-npm-production"}},"0.65.3":{"name":"@happyvertical/pdf","version":"0.65.3","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"license":"MIT","_id":"@happyvertical/pdf@0.65.3","maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"homepage":"https://github.com/happyvertical/pdf#readme","bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"dist":{"shasum":"d2b90477abe078fc960c338dd415f31826cd78d3","tarball":"https://registry.npmjs.org/@happyvertical/pdf/-/pdf-0.65.3.tgz","fileCount":53,"integrity":"sha512-kxsONlwyMFRLe28VpffoRwiB1VBKlLX3R5FxBL6NO+ItNdfIL5/TtGfmWVrPSswQ6kq9smgeLUujUUvRz60T3g==","signatures":[{"sig":"MEYCIQC/Us4K3tIGgx8HieWLSUBaa4PhhxU5i6X95HMrJ4JgvQIhAObqBw3CTBCeJG0FZGsostSDeXIAhHj2Pip1rg+GFXsQ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":465195},"main":"./dist/index.js","type":"module","_from":"file:happyvertical-pdf-0.65.3.tgz","types":"./dist/index.d.ts","engines":{"node":">=24","pnpm":">=9"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"npm run build:watch & npm run test:watch","lint":"biome check .","test":"vitest run --testTimeout 120000","build":"vite build","clean":"rm -rf dist *.tsbuildinfo","format":"biome format --write src/","docs:api":"typedoc --options typedoc.json","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest --testTimeout 120000","build:watch":"vite build --watch","test:coverage":"vitest run --coverage --testTimeout 120000","changeset:auto":"npx tsx scripts/auto-changeset.ts","docs:api:check":"tsx scripts/check-generated-api-docs.ts","changeset:publish":"changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"wllgrffn","email":"willgriffin@gmail.com"},"_resolved":"/tmp/b11e9cd56c2695651db614c3dac674d3/happyvertical-pdf-0.65.3.tgz","_integrity":"sha512-kxsONlwyMFRLe28VpffoRwiB1VBKlLX3R5FxBL6NO+ItNdfIL5/TtGfmWVrPSswQ6kq9smgeLUujUUvRz60T3g==","repository":{"url":"git+https://github.com/happyvertical/pdf.git","type":"git"},"_npmVersion":"11.16.0","description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","directories":{},"_nodeVersion":"24.18.0","dependencies":{"unpdf":"^1.4.0","marked":"^14.1.4","pdf-lib":"^1.17.1","pdfjs-dist":"5.4.296","puppeteer-core":"^25.1.0","@napi-rs/canvas":"0.1.99","@happyvertical/ocr":"^0.60.53","@happyvertical/utils":"^0.74.9"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.0","vite":"7.3.2","vitest":"^4.0.8","typedoc":"^0.28.19","lefthook":"^1.11.13","typescript":"^5.9.3","@types/node":"24.12.2","@biomejs/biome":"1.9.4","@changesets/cli":"^2.29.8","@commitlint/cli":"^19.8.1","vite-plugin-dts":"4.5.4","@vitest/coverage-v8":"^4.0.15","@commitlint/config-conventional":"^19.8.1"},"optionalDependencies":{"@kreuzberg/node":"^4.1.1"},"_npmOperationalInternal":{"tmp":"tmp/pdf_0.65.3_1782357670989_0.22336308931287752","host":"s3://npm-registry-packages-npm-production"}},"0.65.4":{"name":"@happyvertical/pdf","version":"0.65.4","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"license":"MIT","_id":"@happyvertical/pdf@0.65.4","maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"homepage":"https://github.com/happyvertical/pdf#readme","bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"dist":{"shasum":"657800d419d83118b6cd7327ebf4df8b4b1049aa","tarball":"https://registry.npmjs.org/@happyvertical/pdf/-/pdf-0.65.4.tgz","fileCount":57,"integrity":"sha512-Y70f2dVv2A5AjV3cAFt3zMMFd1zQSVCBKwKFJupGXL6XsxWHxwzklk1ZHHcf7marJW4G9Ps4sYdX/RopgysGtQ==","signatures":[{"sig":"MEUCIQCyZpeNc4sQl7OTLfZBXWh9HeqaW07HuGaIYkwBNAJpdgIgC1MZ8xiUPue/05mxeB29WPVoOKS9wD5tjY/fGCHbXuE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":465305},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=24","pnpm":">=11.13.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"npm run build:watch & npm run test:watch","lint":"biome check .","test":"vitest run --testTimeout 120000","build":"vite build","clean":"rm -rf dist *.tsbuildinfo","format":"biome format --write src/","docs:api":"typedoc --options typedoc.json","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest --testTimeout 120000","build:watch":"vite build --watch","test:coverage":"vitest run --coverage --testTimeout 120000","changeset:auto":"npx tsx scripts/auto-changeset.ts","docs:api:check":"tsx scripts/check-generated-api-docs.ts","changeset:publish":"changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"wllgrffn","email":"willgriffin@gmail.com"},"repository":{"url":"https://github.com/happyvertical/pdf.git","type":"git"},"description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","directories":{},"_nodeVersion":"24.18.0","dependencies":{"unpdf":"^1.4.0","marked":"^14.1.4","pdf-lib":"^1.17.1","pdfjs-dist":"5.4.296","puppeteer-core":"^25.1.0","@napi-rs/canvas":"0.1.99","@happyvertical/ocr":"^0.60.53","@happyvertical/utils":"^0.74.9"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.0","vite":"8.1.4","vitest":"4.1.10","typedoc":"^0.28.19","lefthook":"2.1.10","typescript":"5.9.3","@types/node":"24.12.2","@biomejs/biome":"2.5.3","@changesets/cli":"^2.29.8","@commitlint/cli":"^19.8.1","vite-plugin-dts":"4.5.4","@vitest/coverage-v8":"4.1.10","@commitlint/config-conventional":"^19.8.1"},"optionalDependencies":{"@kreuzberg/node":"^4.1.1"},"_npmOperationalInternal":{"tmp":"tmp/pdf_0.65.4_1784125015229_0.45459013613598453","host":"s3://npm-registry-packages-npm-production"}},"0.65.5":{"name":"@happyvertical/pdf","version":"0.65.5","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"license":"MIT","_id":"@happyvertical/pdf@0.65.5","maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"homepage":"https://github.com/happyvertical/pdf#readme","bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"dist":{"shasum":"7e9917fd5953521ffe2039cf95d4d97f4e8a1ffd","tarball":"https://registry.npmjs.org/@happyvertical/pdf/-/pdf-0.65.5.tgz","fileCount":57,"integrity":"sha512-8XvncVUOFyYmsKgLWb1O1k9QLLr33QTDkRMo+2idAXvUfOb4zhNlGTzVm+QkJEoWiHLebc/licF9Qqbri6mFiw==","signatures":[{"sig":"MEUCIEst+KluivxT41PXg25UiMhOjS//vF/78QtNQsuSoraaAiEA7+6P+jbcXGmVGvEBHPCBn7hUhVcMxzkA2QA/UfCetI4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":466407},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=24","pnpm":">=11.13.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"npm run build:watch & npm run test:watch","lint":"biome check .","test":"vitest run --testTimeout 120000","build":"vite build","clean":"rm -rf dist *.tsbuildinfo","format":"biome format --write src/","docs:api":"typedoc --options typedoc.json","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest --testTimeout 120000","build:watch":"vite build --watch","test:coverage":"vitest run --coverage --testTimeout 120000","changeset:auto":"npx tsx scripts/auto-changeset.ts","docs:api:check":"tsx scripts/check-generated-api-docs.ts","changeset:publish":"changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"wllgrffn","email":"willgriffin@gmail.com"},"repository":{"url":"https://github.com/happyvertical/pdf.git","type":"git"},"description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","directories":{},"_nodeVersion":"24.18.0","dependencies":{"unpdf":"^1.6.2","marked":"^18.0.6","pdf-lib":"^1.17.1","pdfjs-dist":"6.1.200","puppeteer-core":"^25.3.0","@napi-rs/canvas":"0.1.100","@happyvertical/ocr":"^0.61.1","@happyvertical/utils":"^0.80.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","vite":"8.1.4","vitest":"4.1.10","typedoc":"^0.28.20","lefthook":"2.1.10","typescript":"6.0.3","@types/node":"24.13.3","@biomejs/biome":"2.5.4","@changesets/cli":"^2.31.0","@commitlint/cli":"^21.2.1","vite-plugin-dts":"5.0.3","@vitest/coverage-v8":"4.1.10","@commitlint/config-conventional":"^21.2.0"},"optionalDependencies":{"@kreuzberg/node":"^4.10.2"},"_npmOperationalInternal":{"tmp":"tmp/pdf_0.65.5_1784154338605_0.7762804307568338","host":"s3://npm-registry-packages-npm-production"}},"0.65.6":{"name":"@happyvertical/pdf","version":"0.65.6","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"license":"MIT","_id":"@happyvertical/pdf@0.65.6","maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"homepage":"https://github.com/happyvertical/pdf#readme","bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"dist":{"shasum":"f7c9b4d7685c00184056b61eb6f439ca28863f33","tarball":"https://registry.npmjs.org/@happyvertical/pdf/-/pdf-0.65.6.tgz","fileCount":57,"integrity":"sha512-uOUHww2+bjBf8DRptrKZ2YlHG5d3RMwGzpT+Jepf1AUdPCUxS4mqi4FtUvtumU+w46cfcwUeehxV1y3FiBiehg==","signatures":[{"sig":"MEUCIG5zngnlLBWNvasFHR2TvDDTqjNd4ldOl73e7FxOXbxwAiEA1MLDArBj0WV3rHy9WPGRGC+j35XokKTrkmHevWXDM1Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":466407},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=24","pnpm":">=11.13.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"npm run build:watch & npm run test:watch","lint":"biome check .","test":"vitest run --testTimeout 120000","build":"vite build","clean":"rm -rf dist *.tsbuildinfo","format":"biome format --write src/","docs:api":"typedoc --options typedoc.json","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest --testTimeout 120000","build:watch":"vite build --watch","test:coverage":"vitest run --coverage --testTimeout 120000","changeset:auto":"npx tsx scripts/auto-changeset.ts","docs:api:check":"tsx scripts/check-generated-api-docs.ts","changeset:publish":"changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"wllgrffn","email":"willgriffin@gmail.com"},"repository":{"url":"https://github.com/happyvertical/pdf.git","type":"git"},"description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","directories":{},"_nodeVersion":"24.18.0","dependencies":{"unpdf":"^1.6.2","marked":"^18.0.6","pdf-lib":"^1.17.1","pdfjs-dist":"6.1.200","puppeteer-core":"^25.3.0","@napi-rs/canvas":"0.1.100","@happyvertical/ocr":"^0.61.1","@happyvertical/utils":"^0.80.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","vite":"8.1.4","vitest":"4.1.10","typedoc":"^0.28.20","lefthook":"2.1.10","typescript":"6.0.3","@types/node":"24.13.3","@biomejs/biome":"2.5.4","@changesets/cli":"^2.31.0","@commitlint/cli":"^21.2.1","vite-plugin-dts":"5.0.3","@vitest/coverage-v8":"4.1.10","@commitlint/config-conventional":"^21.2.0"},"optionalDependencies":{"@kreuzberg/node":"^4.10.2"},"_npmOperationalInternal":{"tmp":"tmp/pdf_0.65.6_1784368834734_0.011465230650642866","host":"s3://npm-registry-packages-npm-production"}},"0.65.7":{"name":"@happyvertical/pdf","version":"0.65.7","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"license":"MIT","_id":"@happyvertical/pdf@0.65.7","maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"homepage":"https://github.com/happyvertical/pdf#readme","bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"dist":{"shasum":"decd2cdee1c6f21133c6b63a515c84d39f8a18d9","tarball":"https://registry.npmjs.org/@happyvertical/pdf/-/pdf-0.65.7.tgz","fileCount":66,"integrity":"sha512-sLNH5xMmxsq40aIfXDwSiX3BdyuX69MnJzxFR63qctQZXzWLLQqk2RTStLVx+Zga7qBSamsex8K4NmDN9yxwng==","signatures":[{"sig":"MEQCIHU38y/rwjRg/loxYqHbB8oRu1B6A8P6l91b6dnXah4YAiAnbEUvvQeJ4n+6HMnxDfC3CYov/eQP5qRv1/3X7LJkwQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":497948},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=24","pnpm":">=11.13.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"npm run build:watch & npm run test:watch","lint":"biome check .","test":"vitest run --testTimeout 120000","build":"vite build","clean":"rm -rf dist *.tsbuildinfo","format":"biome format --write src/","docs:api":"typedoc --options typedoc.json","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest --testTimeout 120000","build:watch":"vite build --watch","test:coverage":"vitest run --coverage --testTimeout 120000","changeset:auto":"npx tsx scripts/auto-changeset.ts","docs:api:check":"tsx scripts/check-generated-api-docs.ts","changeset:publish":"changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"wllgrffn","email":"willgriffin@gmail.com"},"repository":{"url":"https://github.com/happyvertical/pdf.git","type":"git"},"description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","directories":{},"_nodeVersion":"24.18.0","dependencies":{"unpdf":"^1.6.2","marked":"^18.0.6","pdf-lib":"^1.17.1","pdfjs-dist":"6.1.200","puppeteer-core":"^25.3.0","@napi-rs/canvas":"0.1.100","@happyvertical/ocr":"^0.61.1","@happyvertical/utils":"^0.80.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","vite":"8.1.4","vitest":"4.1.10","typedoc":"^0.28.20","lefthook":"2.1.10","typescript":"6.0.3","@types/node":"24.13.3","@biomejs/biome":"2.5.4","@changesets/cli":"^2.31.0","@commitlint/cli":"^21.2.1","vite-plugin-dts":"5.0.3","@vitest/coverage-v8":"4.1.10","@commitlint/config-conventional":"^21.2.0"},"optionalDependencies":{"@kreuzberg/node":"^4.10.2"},"_npmOperationalInternal":{"tmp":"tmp/pdf_0.65.7_1785295157907_0.9495742554168909","host":"s3://npm-registry-packages-npm-production"}},"0.65.8":{"name":"@happyvertical/pdf","version":"0.65.8","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"license":"MIT","_id":"@happyvertical/pdf@0.65.8","maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"homepage":"https://github.com/happyvertical/pdf#readme","bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"dist":{"shasum":"739f3dc4d1dc292005b51ad1f11a432bf41fd73e","tarball":"https://registry.npmjs.org/@happyvertical/pdf/-/pdf-0.65.8.tgz","fileCount":66,"integrity":"sha512-KahZTgmkgmPEFgZnEE5APPhkg9QylpfdzzT/JvY5h/FjFOyMMGcd3cc2zUm5sib4l2CjX+9RJiDdDxr5xMp4Pw==","signatures":[{"sig":"MEQCIGs1Q9fVvy209/c50auJPtQ62u7O5WKRk2BJfXsua00fAiB8ZqcfRAmAtExNsWLbnuUkCjrOuer9ET5LTbc8tTbfJg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":501922},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=24","pnpm":">=11.13.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"npm run build:watch & npm run test:watch","lint":"biome check .","test":"vitest run --testTimeout 120000","build":"vite build","clean":"rm -rf dist *.tsbuildinfo","format":"biome format --write src/","docs:api":"typedoc --options typedoc.json","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest --testTimeout 120000","build:watch":"vite build --watch","test:coverage":"vitest run --coverage --testTimeout 120000","changeset:auto":"npx tsx scripts/auto-changeset.ts","docs:api:check":"tsx scripts/check-generated-api-docs.ts","changeset:publish":"changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"wllgrffn","email":"willgriffin@gmail.com"},"repository":{"url":"https://github.com/happyvertical/pdf.git","type":"git"},"description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","directories":{},"_nodeVersion":"24.18.0","dependencies":{"unpdf":"^1.6.2","marked":"^18.0.6","pdf-lib":"^1.17.1","pdfjs-dist":"6.1.200","puppeteer-core":"^25.3.0","@napi-rs/canvas":"0.1.100","@happyvertical/ocr":"^0.61.1","@happyvertical/utils":"^0.80.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","vite":"8.1.4","vitest":"4.1.10","typedoc":"^0.28.20","lefthook":"2.1.10","typescript":"6.0.3","@types/node":"24.13.3","@biomejs/biome":"2.5.4","@changesets/cli":"^2.31.0","@commitlint/cli":"^21.2.1","vite-plugin-dts":"5.0.3","@vitest/coverage-v8":"4.1.10","@commitlint/config-conventional":"^21.2.0"},"optionalDependencies":{"@kreuzberg/node":"^4.10.2"},"_npmOperationalInternal":{"tmp":"tmp/pdf_0.65.8_1785348490714_0.14261242276795882","host":"s3://npm-registry-packages-npm-production"}},"0.65.9":{"name":"@happyvertical/pdf","version":"0.65.9","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"license":"MIT","_id":"@happyvertical/pdf@0.65.9","maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"homepage":"https://github.com/happyvertical/pdf#readme","bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"dist":{"shasum":"f45d373318c9fef95ab46bd177114ba4f7bc557b","tarball":"https://registry.npmjs.org/@happyvertical/pdf/-/pdf-0.65.9.tgz","fileCount":66,"integrity":"sha512-FnyCI8N8YQeeuKUQdiiPoKkN4U4Hqgf/N+7Vw1HMAw0vmoliNGlPJBZcqzl6hX4N3ZdXYNP6pqiVHGmPiDiBhw==","signatures":[{"sig":"MEUCIQCCHH2rDQxctJTx5pozN0oxe259/2X9mg5JVKioRcrf3wIgDcylu6hPLLQ3FRUAN6tM4GLYZ8/cQZk/p1B8KK2Fwas=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":501922},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=24","pnpm":">=11.13.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"npm run build:watch & npm run test:watch","lint":"biome check .","test":"vitest run --testTimeout 120000","build":"vite build","clean":"rm -rf dist *.tsbuildinfo","format":"biome format --write src/","docs:api":"typedoc --options typedoc.json","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest --testTimeout 120000","build:watch":"vite build --watch","test:coverage":"vitest run --coverage --testTimeout 120000","changeset:auto":"npx tsx scripts/auto-changeset.ts","docs:api:check":"tsx scripts/check-generated-api-docs.ts","changeset:publish":"changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"wllgrffn","email":"willgriffin@gmail.com"},"repository":{"url":"https://github.com/happyvertical/pdf.git","type":"git"},"description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","directories":{},"_nodeVersion":"24.18.1","dependencies":{"unpdf":"^1.6.2","marked":"^18.0.6","pdf-lib":"^1.17.1","pdfjs-dist":"6.1.200","puppeteer-core":"^25.3.0","@napi-rs/canvas":"0.1.100","@happyvertical/ocr":"^0.61.1","@happyvertical/utils":"^0.80.1"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","vite":"8.1.4","vitest":"4.1.10","typedoc":"^0.28.20","lefthook":"2.1.10","typescript":"6.0.3","@types/node":"24.13.3","@biomejs/biome":"2.5.4","@changesets/cli":"^2.31.0","@commitlint/cli":"^21.2.1","vite-plugin-dts":"5.0.3","@vitest/coverage-v8":"4.1.10","@commitlint/config-conventional":"^21.2.0"},"optionalDependencies":{"@kreuzberg/node":"^4.10.2"},"_npmOperationalInternal":{"tmp":"tmp/pdf_0.65.9_1785517402929_0.5585671539738621","host":"s3://npm-registry-packages-npm-production"}},"0.67.1":{"name":"@happyvertical/pdf","version":"0.67.1","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"license":"MIT","_id":"@happyvertical/pdf@0.67.1","maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"homepage":"https://github.com/happyvertical/pdf#readme","bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"dist":{"shasum":"efbd61992a264e8d6486363442f1b00c6f9156a3","tarball":"https://registry.npmjs.org/@happyvertical/pdf/-/pdf-0.67.1.tgz","fileCount":82,"integrity":"sha512-T2RXMueivmuQ9ObtjuvtJkuM3jM79m6xfjaEO2PT5uq0MJ4o9iPVwHQm0c2teZMq+yIxeHYssoCQcecNIVuVgA==","signatures":[{"sig":"MEUCIGD3XYB7VWES+0pDQ5bG8p4cBRlSat3/6m6mUJCzR4DpAiEAnu9XBCDXXir2Na/74YllXiy4zc0GbXQbLAsMjphtV6w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQCFv4plv4UttMUkm7AtaJ0EbWHE6rLcLfVDd9xMv4tyqwIgVJyGNtI0+lgAnlcuxjLwKTD/a2zR+KzdzpkbYGH7e6o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":635948},"main":"./dist/index.js","type":"module","_from":"file:mirror-pack/happyvertical-pdf-0.67.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=24","pnpm":">=11.13.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"npm run build:watch & npm run test:watch","lint":"biome check .","test":"vitest run --testTimeout 120000","build":"vite build","clean":"rm -rf dist *.tsbuildinfo","format":"biome format --write src/","docs:api":"typedoc --options typedoc.json","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest --testTimeout 120000","build:watch":"vite build --watch","test:coverage":"vitest run --coverage --testTimeout 120000","changeset:auto":"npx tsx scripts/auto-changeset.ts","docs:api:check":"tsx scripts/check-generated-api-docs.ts","changeset:publish":"changeset publish","changeset:version":"changeset version"},"_npmUser":{"name":"wllgrffn","email":"willgriffin@gmail.com"},"_resolved":"/home/runner/_work/pdf/pdf/mirror-pack/happyvertical-pdf-0.67.1.tgz","_integrity":"sha512-T2RXMueivmuQ9ObtjuvtJkuM3jM79m6xfjaEO2PT5uq0MJ4o9iPVwHQm0c2teZMq+yIxeHYssoCQcecNIVuVgA==","repository":{"url":"git+https://github.com/happyvertical/pdf.git","type":"git"},"_npmVersion":"11.19.1","description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","directories":{},"_nodeVersion":"24.22.0","dependencies":{"unpdf":"^1.6.2","marked":"^18.0.6","pdf-lib":"^1.17.1","pdfjs-dist":"6.1.200","puppeteer-core":"^25.3.0","@napi-rs/canvas":"0.1.100","@happyvertical/ocr":"^0.61.1","@happyvertical/utils":"^0.80.1"},"publishConfig":{"access":"public","registry":"https://npm.happyvertical.com/"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","vite":"8.1.4","vitest":"4.1.10","typedoc":"^0.28.20","lefthook":"2.1.10","typescript":"6.0.3","@types/node":"24.13.3","@biomejs/biome":"2.5.4","@changesets/cli":"^2.31.0","@commitlint/cli":"^21.2.1","vite-plugin-dts":"5.0.3","@vitest/coverage-v8":"4.1.10","@commitlint/config-conventional":"^21.2.0"},"optionalDependencies":{"@kreuzberg/node":"^4.10.2"},"_npmOperationalInternal":{"tmp":"tmp/pdf_0.67.1_1792175145431_0.8960273511404679","host":"s3://npm-registry-packages-npm-production"}},"0.67.2":{"_id":"@happyvertical/pdf@0.67.2","bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"dist":{"shasum":"50237742b446ce6b822b83d0f8df14ce6780b997","tarball":"https://registry.npmjs.org/@happyvertical/pdf/-/pdf-0.67.2.tgz","fileCount":82,"integrity":"sha512-XdMqaX2aJ9GKzD4nYBhgZTPj3c3k5yHHConTt2xUSkE2b0AKBmlyJrFY0ny9abb9MKcnK0ogjSmfqVggYXPrQg==","signatures":[{"sig":"MEUCIQDei+SBG/RlOl+UncMIVsPsl68jaeYYQQIhNVWzZxrO7AIgX+8auACuGEtiiyTpAooOF+lSPbAfjuLRtrKLyczrnVI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIESHfQzLVE/M5/V+toDQ+38OHQJtnjsLpUDr6Lm3m7AWAiEAx25M2rXgnt9tQJo1Tr/G/vgd2ha2gBi4qgfNkRtyKEo="}],"unpackedSize":636886},"main":"./dist/index.js","name":"@happyvertical/pdf","type":"module","_from":"file:mirror-pack/happyvertical-pdf-0.67.2.tgz","types":"./dist/index.d.ts","engines":{"node":">=24","pnpm":">=11.13.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"license":"MIT","scripts":{"dev":"npm run build:watch & npm run test:watch","lint":"biome check .","test":"vitest run --testTimeout 120000","build":"vite build","clean":"rm -rf dist *.tsbuildinfo","format":"biome format --write src/","docs:api":"typedoc --options typedoc.json","changeset":"changeset","typecheck":"tsc --noEmit","test:watch":"vitest --testTimeout 120000","build:watch":"vite build --watch","test:coverage":"vitest run --coverage --testTimeout 120000","changeset:auto":"npx tsx scripts/auto-changeset.ts","docs:api:check":"tsx scripts/check-generated-api-docs.ts","changeset:publish":"changeset publish","changeset:version":"changeset version"},"version":"0.67.2","_npmUser":{"name":"wllgrffn","email":"willgriffin@gmail.com"},"homepage":"https://github.com/happyvertical/pdf#readme","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"_resolved":"/home/runner/work/pdf/pdf/mirror-pack/happyvertical-pdf-0.67.2.tgz","_integrity":"sha512-XdMqaX2aJ9GKzD4nYBhgZTPj3c3k5yHHConTt2xUSkE2b0AKBmlyJrFY0ny9abb9MKcnK0ogjSmfqVggYXPrQg==","repository":{"url":"git+https://github.com/happyvertical/pdf.git","type":"git"},"_npmVersion":"11.19.1","description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","directories":{},"maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"_nodeVersion":"24.22.2","dependencies":{"unpdf":"^1.6.2","marked":"^18.0.6","pdf-lib":"^1.17.1","pdfjs-dist":"6.1.200","puppeteer-core":"^25.3.0","@napi-rs/canvas":"0.1.100","@happyvertical/ocr":"^0.61.1","@happyvertical/utils":"^0.80.1"},"publishConfig":{"access":"public","registry":"https://npm.happyvertical.com/"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.23.1","vite":"8.1.4","vitest":"4.1.10","typedoc":"^0.28.20","lefthook":"2.1.10","typescript":"6.0.3","@types/node":"24.13.3","@biomejs/biome":"2.5.4","@changesets/cli":"^2.31.0","@commitlint/cli":"^21.2.1","vite-plugin-dts":"5.0.3","@vitest/coverage-v8":"4.1.10","@commitlint/config-conventional":"^21.2.0"},"optionalDependencies":{"@kreuzberg/node":"^4.10.2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pdf_0.67.2_1794235663798_0.2047843546455208"}}},"time":{"created":"2026-06-24T09:11:07.783Z","modified":"2026-11-09T14:47:44.166Z","0.65.2":"2026-06-24T09:11:08.112Z","0.65.3":"2026-06-25T03:21:11.163Z","0.65.4":"2026-07-15T14:16:55.379Z","0.65.5":"2026-07-15T22:25:38.774Z","0.65.6":"2026-07-18T10:00:34.883Z","0.65.7":"2026-07-29T03:19:18.043Z","0.65.8":"2026-07-29T18:08:10.871Z","0.65.9":"2026-07-31T17:03:23.074Z","0.67.1":"2026-10-16T18:25:45.540Z","0.67.2":"2026-11-09T14:47:43.905Z"},"bugs":{"url":"https://github.com/happyvertical/pdf/issues"},"license":"MIT","homepage":"https://github.com/happyvertical/pdf#readme","keywords":["pdf","ocr","text-extraction","pdf-generation","html-to-pdf","markdown-to-pdf","unpdf"],"repository":{"url":"git+https://github.com/happyvertical/pdf.git","type":"git"},"description":"Node.js PDF extraction, OCR fallback, image extraction, and PDF generation utilities","maintainers":[{"name":"wllgrffn","email":"willgriffin@gmail.com"}],"readme":"# @happyvertical/pdf\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nNode.js PDF utilities for extracting text, reading metadata, extracting or\nrendering images, running OCR fallback, and generating PDFs from Markdown or\nHTML.\n\n## Features\n\n- Direct PDF text, metadata, and image extraction through `unpdf`\n- OCR fallback for scanned or image-based PDFs through `@happyvertical/ocr`\n- Document analysis with `getInfo()` strategy recommendations\n- Batched image extraction for large PDFs\n- Web-safe image output from extracted PDF images (`webp` by default)\n- Markdown-to-PDF generation with `pdf-lib` and `marked`\n- HTML-to-PDF generation with `puppeteer-core` and a system Chromium\n- Typed errors for dependency, file-size, image-collection, and OCR failures\n\n## Requirements\n\n- Node.js `>=24`\n- ESM imports\n- A Chromium or Chrome binary only when using `renderHtmlToPdf`\n- Extra memory for OCR-heavy workloads; 2 GB+ is a practical starting point\n\nThis package is currently Node-first. Browser provider code exists internally,\nbut the public package export does not expose a stable browser entry point yet.\n\n## Installation\n\n```bash\npnpm add @happyvertical/pdf\nnpm install @happyvertical/pdf\nyarn add @happyvertical/pdf\nbun add @happyvertical/pdf\n```\n\nReleases are published to the organisation registry, `https://npm.happyvertical.com/`\n(which proxies npmjs for reads), and mirrored to npmjs on a best-effort basis.\nMap the scope to it in your project `.npmrc` to install from the primary:\n\n```ini\n@happyvertical:registry=https://npm.happyvertical.com/\n```\n\n## Basic Usage\n\n```typescript\nimport { getPDFReader } from '@happyvertical/pdf';\n\nconst reader = await getPDFReader();\nconst text = await reader.extractText('/path/to/document.pdf');\n\nconsole.log(text);\n```\n\n`extractText()` first tries embedded PDF text. When OCR is enabled and direct\ntext extraction finds nothing useful, the Node reader renders pages and sends\nthem through `@happyvertical/ocr`.\n\nWith the Node `unpdf` provider, pass `{ preserveFormatting: true }` to retain\nthe line breaks detected in embedded text. Use `pages` to select individual\npages, or leave `mergePages` unset to separate pages with a blank line.\n\n## Analyze Before Processing\n\nUse `getInfo()` when routing many documents or deciding whether OCR is likely\nto be needed.\n\n```typescript\nimport { getPDFReader } from '@happyvertical/pdf';\n\nconst reader = await getPDFReader();\nconst info = await reader.getInfo('/path/to/document.pdf');\n\nconsole.log({\n  pages: info.pageCount,\n  hasEmbeddedText: info.hasEmbeddedText,\n  hasImages: info.hasImages,\n  strategy: info.recommendedStrategy,\n});\n\nconst text = await reader.extractText('/path/to/document.pdf', {\n  skipOCRFallback: info.recommendedStrategy === 'text',\n});\n```\n\n## Metadata And Images\n\n```typescript\nimport { getPDFReader } from '@happyvertical/pdf';\n\nconst reader = await getPDFReader();\n\nconst metadata = await reader.extractMetadata('/path/to/document.pdf');\nconsole.log(metadata.title, metadata.author, metadata.pageCount);\n\nconst images = await reader.extractImages('/path/to/document.pdf');\nconsole.log(images.map((image) => image.format)); // image/webp by default\n```\n\n`extractImages()` returns WebP images by default so callers can store or serve\n`image.data` directly. Pass `outputFormat: 'original'` when you need the raw\nprovider bytes, especially for OCR pipelines that prefer raw RGB data.\n\n```typescript\nconst rawImages = await reader.extractImages('/path/to/document.pdf', {\n  outputFormat: 'original',\n});\n```\n\nFor image-heavy PDFs, process image batches incrementally instead of retaining\nevery image buffer in memory.\n\n```typescript\nawait reader.extractImages('/path/to/large-document.pdf', {\n  batchSize: 4,\n  collect: false,\n  onBatch: async ({ images, pages }) => {\n    console.log(`Processing ${images.length} images from pages ${pages.join(', ')}`);\n  },\n});\n```\n\n## Explicit OCR\n\nFor scanned PDFs, prefer `extractText()` with OCR fallback. If you need to call\nOCR yourself, render full pages rather than extracting embedded images.\n\n```typescript\nimport { getPDFReader } from '@happyvertical/pdf';\n\nconst reader = await getPDFReader({\n  defaultOCROptions: {\n    language: 'eng',\n    confidenceThreshold: 70,\n  },\n});\n\nconst pages = await reader.renderPages('/path/to/scanned.pdf', {\n  scale: 2,\n  outputFormat: 'original',\n});\n\nconst result = await reader.performOCR(pages);\nconsole.log(result.text, result.confidence);\n```\n\n## Generate PDFs\n\n### Markdown\n\n`renderMarkdownToPdf()` is pure JavaScript. It supports common Markdown blocks\nand inline emphasis, uses PDF standard fonts, and paginates content.\n\n```typescript\nimport { writeFile } from 'node:fs/promises';\nimport { renderMarkdownToPdf } from '@happyvertical/pdf';\n\nconst pdf = await renderMarkdownToPdf('# Status\\n\\nEverything is green.', {\n  title: 'Status Report',\n  pageSize: 'letter',\n});\n\nawait writeFile('status.pdf', pdf);\n```\n\n### Images\n\n`imagesToPdf()` puts one image on each page, in the order given, with `pdf-lib`\nonly: no browser, no network, and nothing written to disk. It returns the PDF\nbytes. Inputs are `Buffer`, `Uint8Array`, or a file path.\n\n```typescript\nimport { writeFile } from 'node:fs/promises';\nimport { imagesToPdf } from '@happyvertical/pdf';\n\nconst pdf = await imagesToPdf(['page-1.jpg', page2Buffer], {\n  pageSize: 'letter',\n  fit: 'contain',\n  margin: 36,\n  title: 'Mill certificate',\n  creationDate: new Date('2026-10-04T00:00:00Z'), // same inputs + date = same bytes\n});\n\nawait writeFile('cert.pdf', pdf);\n```\n\n- Types: PNG (including alpha) and JPEG, detected by file signature, never by\n  file name or MIME type. JPEG EXIF orientation 1-8 is applied, so a phone\n  photo comes out upright. **WebP is not supported** and throws\n  `PDFImageUnsupportedTypeError`: `@napi-rs/canvas` can spin forever decoding a\n  damaged WebP, so untrusted WebP is never handed to it. Convert it first.\n- `pageSize`: `'image'` (default; the page is the image at `dpi`), `'letter'`,\n  `'legal'`, `'a3'`, `'a4'`, `'a5'`, or `{ width, height }` in points.\n  `orientation: 'auto'` (default) picks portrait or landscape per image for\n  named and explicit sizes; `'portrait'` / `'landscape'` force one.\n- `fit`: `'contain'` (default) shows the whole image; `'cover'` fills the area\n  inside the margin and crops to it. `margin` is points on every side\n  (default 0; in `'image'` mode it is added around the image). `dpi` default 150.\n- `title` and `creationDate` set the document metadata. Without `creationDate`\n  the current time is used, so output is not byte-stable.\n- Limits (inputs are untrusted): `maxImages` 100, `maxImageBytes` 25 MiB,\n  `maxTotalBytes` 256 MiB, `maxImagePixels` 50 million. Exceeding one throws\n  `PDFImageLimitExceededError` (`limit`, `actual`, `max`, `index`). A truncated\n  or damaged image throws `PDFImageCorruptError`; an unsupported type throws\n  `PDFImageUnsupportedTypeError`. None of the errors carry image contents or\n  paths, only the image's `index`. Bad option values and an empty list throw\n  `PDFGenerationError`. PNG data is checksummed and size-checked before\n  decoding.\n\n### HTML\n\n`renderHtmlToPdf()` uses `puppeteer-core` and never downloads a browser. Install\nChromium in the runtime image or set `PUPPETEER_EXECUTABLE_PATH`.\n\n```typescript\nimport { writeFile } from 'node:fs/promises';\nimport { renderHtmlToPdf } from '@happyvertical/pdf';\n\nconst pdf = await renderHtmlToPdf('<h1>Invoice</h1>', {\n  format: 'Letter',\n  margin: { top: '0.5in', bottom: '0.5in' },\n});\n\nawait writeFile('invoice.pdf', pdf);\n```\n\nYou can also pass `executablePath` directly or call\n`resolveChromiumExecutablePath()` to inspect what binary will be used.\n\n## Configuration\n\n```typescript\nimport { getPDFReader } from '@happyvertical/pdf';\n\nconst reader = await getPDFReader({\n  provider: 'auto',\n  enableOCR: true,\n  timeout: 30_000,\n  maxFileSize: 50 * 1024 * 1024,\n  ocrProvider: 'auto',\n  defaultOCROptions: {\n    language: 'eng',\n    confidenceThreshold: 70,\n  },\n});\n```\n\nEnvironment variables use the `HAVE_PDF_` prefix and are merged with explicit\noptions. Explicit options always win.\n\n| Environment variable | Type | Example |\n| --- | --- | --- |\n| `HAVE_PDF_ENABLE_OCR` | boolean | `true` |\n| `HAVE_PDF_TIMEOUT` | number | `30000` |\n| `HAVE_PDF_PROVIDER` | string | `auto`, `unpdf`, `kreuzberg`, `paddleocr` |\n| `HAVE_PDF_OCR_PROVIDER` | string | `auto`, `tesseract`, `onnx` |\n| `HAVE_PDF_MAX_FILE_SIZE` | number | `52428800` |\n| `HAVE_PDF_PADDLEOCR_URL` | string | `http://paddleocr-vl:8080` |\n| `HAVE_PDF_PADDLEOCR_API_KEY` | string | bearer token, optional |\n| `HAVE_PDF_PADDLEOCR_PREFER_EMBEDDED_TEXT` | boolean | `true` |\n\n## Providers\n\n- `auto`: default. In Node.js, uses the combined `unpdf` plus OCR reader.\n- `unpdf`: Node.js text, metadata, image extraction, page rendering, and OCR\n  fallback through `@happyvertical/ocr`.\n- `kreuzberg`: optional Node.js provider via `@kreuzberg/node`; useful when\n  available, but not required.\n- `paddleocr`: Node.js reader backed by a remote PaddleOCR-VL service (see\n  [PaddleOCR-VL as a reader](#paddleocr-vl-as-a-reader)). Used only when named;\n  `auto` never selects it.\n\nThe `pdfjs` provider is not a stable public package target yet.\n\nAutomatic selection stays on `unpdf` when `enableOCR` is `false` or\n`ocrProvider` names a backend Kreuzberg cannot serve, since Kreuzberg is in the\nchain for its integrated OCR.\n\n### Kreuzberg needs an AVX2-capable CPU\n\nThe prebuilt `@kreuzberg/node` binary executes AVX2 instructions, so using it on\na pre-AVX2 x86-64 host (`x86-64-v2` and below) raises `SIGILL` and terminates the\nprocess. The binary is loaded lazily on the first native call, so any code that\nmerely asks whether the provider works is enough to trigger it.\n`optionalDependencies` cannot prevent this: npm and pnpm only skip a package by\n`os`, `cpu`, or `libc`, and AVX2 is a microarchitecture level rather than an\narchitecture.\n\nThis package therefore reads the `avx2` flag from `/proc/cpuinfo` before loading\nanything native. Automatic selection falls back to `unpdf` when the flag is\nabsent. Requesting `provider: 'kreuzberg'` explicitly still returns a reader,\nand that reader degrades the same way it does for any other missing dependency\nrather than killing the process: `checkDependencies()` reports\n`available: false` with an error naming AVX2, and extraction calls return their\nempty result. Check `checkDependencies()` before relying on this provider.\n\nNon-Linux and non-x86-64 hosts keep attempting the load: their CPU flags are not\nreadable this way, and the fault has only been observed on older Linux servers.\n\n## Errors\n\n```typescript\nimport {\n  PDFDependencyError,\n  PDFFileSizeError,\n  PDFImageCollectionLimitError,\n  PDFImageCorruptError,\n  PDFImageLimitExceededError,\n  PDFImageUnsupportedTypeError,\n  PDFOCRFallbackError,\n  PDFUnsupportedError,\n  getPDFReader,\n} from '@happyvertical/pdf';\n\ntry {\n  const reader = await getPDFReader();\n  await reader.extractText('/path/to/document.pdf');\n} catch (error) {\n  if (error instanceof PDFDependencyError) {\n    console.error('Missing dependency:', error.message);\n  } else if (error instanceof PDFFileSizeError) {\n    console.error('File too large:', error.message);\n  } else if (error instanceof PDFImageCollectionLimitError) {\n    console.error('Use batched image extraction:', error.message);\n  } else if (error instanceof PDFOCRFallbackError) {\n    console.error('OCR fallback failed:', error.message);\n  } else if (error instanceof PDFUnsupportedError) {\n    console.error('Unsupported operation:', error.message);\n  } else {\n    throw error;\n  }\n}\n```\n\n## Legacy Compatibility\n\nThese exports remain for older callers, but new code should use\n`getPDFReader()`.\n\n```typescript\nimport {\n  checkOCRDependencies,\n  extractImagesFromPDF,\n  extractTextFromPDF,\n  performOCROnImages,\n} from '@happyvertical/pdf';\n```\n\n## Development\n\nLifecycle-protected pull requests merge through the managed merge queue so the\nsynthetic merge revision is revalidated before it reaches `main`.\n\n```bash\npnpm install\npnpm build\npnpm typecheck\npnpm lint\npnpm test\npnpm test:coverage\npnpm docs:api\npnpm docs:api:check\npnpm pack --dry-run\n```\n\nThe package ships generated JavaScript and declaration files from `dist/`.\nRun `pnpm build` to refresh the declarations before inspecting the full API\nsurface locally. The generated API reference lives in `docs/api/`; run\n`pnpm docs:api` after changing public exports or JSDoc, and run\n`pnpm docs:api:check` to verify the committed reference is current. Generate and verify\nthese docs with Node 24, matching CI: TypeDoc compresses its search and navigation\nindexes with the runtime’s zlib, so Node 26 emits different bytes for the same JSON.\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n\n## Remote PaddleOCR-VL document parsing\n\n### PaddleOCR-VL as a reader\n\n`getPDFReader({ provider: 'paddleocr' })` (or `HAVE_PDF_PROVIDER=paddleocr`)\nreturns a complete `PDFReader` that reads through a PaddleOCR-VL\n`/layout-parsing` service, so code written against the reader interface can\nswitch to it without change:\n\n| Operation | Served by |\n| --- | --- |\n| `extractText` | PaddleOCR-VL. Returns its Markdown (tables as HTML); `pages` selects from the parsed pages, so the whole document is parsed once per call. |\n| `performOCR(images)` | PaddleOCR-VL, one request per image, in order. PNG and JPEG are sent as they are; WebP and raw pixels are converted to PNG first. `confidence` is 100 for any text (the service reports none). |\n| `getInfo`, `extractMetadata`, `extractImages`, `renderPages` | Local `unpdf`. The service returns no document metadata, embedded images or page rasters. |\n\n```typescript\nconst reader = await getPDFReader({\n  provider: 'paddleocr',\n  paddleocr: {\n    baseUrl: 'http://paddleocr-vl:8080', // or HAVE_PDF_PADDLEOCR_URL\n    preferEmbeddedText: false, // true: read text-layer PDFs locally\n  },\n});\nconst markdown = await reader.extractText('/path/to/scan.pdf');\n```\n\n- **Explicit only.** The document leaves the process, so `auto` never picks\n  this provider. A missing or invalid service URL fails at `getPDFReader()`.\n- **Embedded text.** By default the service reads every document, including\n  ones with a text layer. With `preferEmbeddedText: true`, a document whose\n  every page has embedded text and no raster images is read locally instead.\n  Scanned, mixed, image-bearing, and uncertain documents still go to the service;\n  the decision checks all pages rather than relying on `getInfo`’s sample. `extractText(..., { skipOCRFallback: true })` always\n  returns only the local text layer.\n- **No fallback.** A service failure throws `PaddleOCRError`. The reader never\n  retries and never substitutes a local OCR engine. Any `ocrProvider` other\n  than `auto` (including `tesseract`) is refused.\n- **Limits.** `paddleocr.maxFileSize` defaults to the reader's `maxFileSize`,\n  then 50 MiB. The size limit is checked before local PDF inspection, extraction,\n  rendering, or remote submission, including local-only text modes. `paddleocr.timeout` defaults to 65 minutes and does not inherit\n  the reader's `timeout`, which is sized for local parsing; a shorter value\n  also bounds the service's cold start.\n- **Pages.** If the service returns a different number of pages than the\n  document has, `extractText` throws `PaddleOCRError` (`EPADDLERESPONSE`)\n  rather than returning short text. `enableOCR: false` reads only the local\n  text layer and sends nothing.\n- **Images.** WebP (the default output of `extractImages`) is converted to PNG\n  before it is sent.\n\nUse `PaddleOCRClient` directly when you need the per-page `layout` objects.\n\n### The client\n\nUse the explicit `PaddleOCRClient` when you want the full layout-aware PaddleOCR\npipeline, including tables and page structure, even for PDFs with embedded text.\nIt calls `/layout-parsing`, not an OpenAI-compatible VLM endpoint. The\n`paddleocr` reader above is built on it; `auto` selection and the image OCR\nproviders are unchanged.\n\n```typescript\nimport { PaddleOCRClient } from '@happyvertical/pdf';\n\nconst parser = new PaddleOCRClient({\n  baseUrl: 'http://paddleocr-vl', // Snail tailnet endpoint\n  // In cluster: http://paddleocr-vl.paddleocr-vl.svc.cluster.local\n  timeout: 65 * 60 * 1000, // includes on-demand wake and response download\n});\nconst result = await parser.parse('/path/to/document.pdf', {\n  signal: AbortSignal.timeout(65 * 60 * 1000),\n});\nconsole.log(result.markdown);\nfor (const page of result.pages) {\n  console.log(page.pageNumber, page.markdown, page.layout);\n}\n```\n\n`baseUrl` defaults to `HAVE_PDF_PADDLEOCR_URL`; an optional `apiKey` defaults to\n`HAVE_PDF_PADDLEOCR_API_KEY` and becomes a bearer header for authenticated proxies.\nExplicit options take precedence. Snail uses private tailnet/namespace access,\nnot built-in bearer authentication; configure that boundary in `iac` before\nexposing this endpoint elsewhere. In-cluster callers must be in a namespace\nlabelled `happyvertical.com/paddleocr-client: \"true\"`.\n\nInputs are local paths, `ArrayBuffer`, or `Uint8Array` (including `Buffer`).\nStrings are never fetched as remote URLs. Inputs are validated for a PDF header\nand limited to 50 MiB by default (`maxFileSize` overrides this). The service's\n70 MiB JSON body limit accommodates that PDF after base64 encoding. The client\nholds the PDF and encoded request in memory. It returns ordered, one-based pages,\nper-page raw layout objects, and joined Markdown. Unknown layout labels are kept.\nSet `returnMarkdownImages: true` to receive the image data/URLs referenced by\nMarkdown; by default these are omitted to reduce response size. Treat returned\nMarkdown, HTML tables, and image URLs as untrusted document content.\n\nThe first request after idle waits for the model. Images may take longer to pull\non the first deployment than the proxy's five-minute wake window; retry after\nstartup completes. Requests are **not automatically retried**, because a timeout\nor disconnect does not guarantee server-side parsing stopped. `PaddleOCRError`\nuses `ETIMEDOUT`, `EABORT`, `EPADDLEHTTP` (with `status`), `EPADDLEAPI`,\n`EPADDLERESPONSE`, or `EPADDLEIO`; invalid input uses `PDFError` and size violations\nuse `PDFFileSizeError`. Error messages do not echo document contents or credentials.\nA proxy `/health` success means the wake route exists, not that the GPU is warm.\nThe initial service handles one document at a time; serialize submissions and\nsplit very long documents. Its idle expiry does not track an in-flight request,\nand client cancellation does not cancel GPU processing.\n","readmeFilename":"README.md"}