Skip to content

extractPdfImages ​

Import from: @xbbg/xnews

extractPdfImages(bytes): Promise<{ images: readonly PdfPageImage[]; warnings: readonly string[]; }>

Defined in: src/pdf.ts (declaration: pdf.d.ts:50)

Extracts the page images a scanned PDF is made of, without rasterizing.

A scan stores each page as one image XObject, and for the dominant encoding (/DCTDecode) the stream bytes already are a JPEG file — a live sample of an 83-page Internet Archive scan was 83 DCTDecode images, byte-identical to valid JFIF once sliced out. That makes OCR reachable without a PDF renderer. Encodings needing a real codec are reported by name instead of guessed at.

Parameters ​

bytes ​

Uint8Array

Returns ​

Promise<{ images: readonly PdfPageImage[]; warnings: readonly string[]; }>

Last updated:

xbbg is independent open-source software and is not affiliated with, endorsed by, sponsored by, or approved by Bloomberg Finance L.P.