Core returns canonical page coordinates in points (1/72 inch), with a top-left origin,
x right and y down. CropBox, UserUnit and page rotation are applied. Page numbers are
one-based; rotation records the original PDF rotation. Reading order is a deterministic
recursive XY-cut over columns and full-width sections, followed by baseline rows and
paragraph spacing; it is not semantic recovery for arbitrary scripts. Tables are detected
heuristically (see Tables), and lines set larger or bolder than body text are
marked as headings.
Each image occurrence has an imageToPage transform [a,b,c,d,e,f], mapping top-left
raster pixel edges to page coordinates: x′ = a*x + c*y + e, y′ = b*x + d*y + f.
Distinct repeated occurrences retain their own placement IDs and transforms. Image IDs
belong to one document and appearance variant; persist their associations in a manifest.
Full image export preserves native resolution even when the PDF draws an image small.
Exports are oriented as the image appears on the page: a placement that mirrors or turns
the stored raster by quarter turns is corrected losslessly, and 90°/270° placements swap
width and height. originalOrientation on each occurrence describes the stored raster:
mirror it horizontally if mirrored, then rotate clockwise by rotation, to get the
page view. Smaller tilts are left as stored. Pass occurrenceId to choose which
placement's orientation applies (default: the first), or preserveOrientation: true for
the raster exactly as stored.
With composite: true, an occurrence that is overlaid (or clipped, or depends on an
unsupported graphics state), or any occurrence when scale is not 1, is instead rendered
with everything drawn above it, at its own pixel size times scale, cropped to its area;
clipped-away areas become transparent. Composites must fit 16,777,216 canvas pixels and
32,767 pixels per side, otherwise they fail with RESOURCE_LIMIT_EXCEEDED. See the
core package page for details.
Inline, nested-form, reused and tiny images are included. Auxiliary masks are applied.
Page clipping is reported on occurrences and does not crop the standalone asset. Explicit
thumbnail bounds request a separate aspect-preserving nearest-neighbor preview.
getImages lists every image unless you pass minWidth and/or minHeight (positive
whole pixels). Images smaller than either bound are left out, measured as exported by
default, so quarter-turn placements count with width and height swapped. The result's
ignoredCount reports how many images on the selected pages were left out. The filter
does not change OCR coverage or which IDs extractImage accepts. Pages whose content has
errors are read leniently, skipping the broken operators; the result's warnings then
lists an IMAGE_INVENTORY_DEGRADED entry for each such selected page.
PNG output contains RGBA8 pixels in sRGB appearance, not original compressed/CMYK samples. Tested paths include RGB/gray/indexed, CMYK and ICC RGB (including DisplayP3), Decode inversion, color-key/soft masks and colored stencil variants. Lossless fixture samples and alpha compare exactly; independent LittleCMS references use documented small color tolerances.
Tested codecs include Flate, JPEG, lossless JPX, CCITT Group4 and JBIG2 MMR generic regions. This is not blanket coverage of every codec mode, spot color or malformed profile. Unsupported compositing/graphics-state dependencies fail explicitly in full exports instead of silently returning a screenshot or degraded raster; only an explicitly requested composite export renders them.
| Default budget | Value |
|---|---|
| Whole input | 256 MiB |
| Pages | 10,000 |
| Native image | 64 million pixels |
| Estimated decoded working memory | 1 GiB |
| OCR working raster | 16 million pixels (page renders and enlarged image regions target 300 DPI) |
| Cached ruling lines for table detection | 200,000 lines (about 8 MB) |
Override "@pdfextract/core".PdfLimits to suit the host. Full exports reject a budget failure rather than downscaling. Decoded memory is estimated at 16 bytes/pixel, not an enforced process-RSS sandbox. Source bytes and parser structures remain resident; decoded images are evicted after export. Application-held output arrays still consume memory.
One document job runs at a time. Cancellation stops queued work immediately; a synchronous
decode already running in a worker may finish before cleanup. close() is idempotent and
joins worker cleanup. Results own their bytes and survive close. Calls after close fail;
closing a PDF never closes its borrowed OCR provider.
Generated fixtures establish a 150-page result and full 8000×5000 export in a provisioned Node environment. Browser tests exercise a clear configured limit for that 40 MP case. There is no unlimited-browser-image or throughput guarantee. The local benchmark command records hardware, separate stage timings, peak RSS and repeated worker/buffer measurements.