Both pages of a property listing brochure carry the brokerage logo at 48 pixels square, a 24-pixel equal-housing badge and two room photographs, and the brokerage keeps every image from every brochure in a compliance archive, logos and badges included, because the archive is where an auditor checks that the approved logo was the one in print.
We looked at how pdf-parse 2.4.5 and IronPDF for Node.js extract images from a PDF in Node.js for that archive, reading the pdf-parse source at its 2.4.5 tag on GitHub and the IronPDF typedoc pages.
Which images does getImage() skip by default?
By default, getImage() skips every image whose width or height is 80 pixels or less. In pdf-parse 2.4.5, setDefaultParseParameters sets imageThreshold to 80 when the caller leaves it out, and the skip test compares that threshold against both the width and the height. For the brochure, that default drops the logo and the badge from the result and keeps the photographs, so the archive copy is incomplete without any error being raised.
import { readFile, writeFile } from "node:fs/promises";
import { PDFParse } from "pdf-parse";
// Load the brochure and switch off the 80-pixel size filter
const parser = new PDFParse({ data: await readFile("maple-court-brochure.pdf") });
const result = await parser.getImage({ imageThreshold: 0 });
// Free the parser, then save the first image from page one
await parser.destroy();
await writeFile("maple-court-p1-1.png", result.pages[0].images[0].data);
Setting imageThreshold to 0 switches the filter off, as the option reference states. The default suits a gallery feed that wants room photographs and nothing smaller, and the archive job has to remember the override in every call that feeds it.
What getImage() needs from the host
Each image passes through a canvas on its way out of getImage(). The canvas in Node.js comes from @napi-rs/canvas, a regular dependency of version 2.4.5 that installs compiled binaries for the host platform. Image extraction therefore depends on that native module being present and loadable wherever the archive job runs, and the project's troubleshooting guide covers the Cannot find module '@napi-rs/canvas' error on serverless hosts.
Collecting the brochure's images with IronPDF for Node.js
On the IronPDF side, a single call on the document does the work. According to the IronPDF for Node.js API reference, extractRawImages finds the embedded images in the selected pages and resolves to an array of Buffer objects, and its only option is fromPages, which defaults to every page.
import { PdfDocument } from "@ironsoftware/ironpdf";
// Open the brochure from disk
const brochure = await PdfDocument.fromFile("maple-court-brochure.pdf");
// Collect the embedded images from every page as buffers
const images = await brochure.extractRawImages();
// Log the size of each buffer before it goes to the compliance archive
images.forEach((image, i) => console.log(`Image ${i + 1}, ${image.length} bytes`));
There is no size threshold in that signature, so the archive job has no default to override and no setting to forget. The same PdfDocument also returns the listing copy through extractText, and the package renders brochures from HTML, so a brokerage that builds its brochures with IronPDF reads them back with the same dependency.
Which other jobs can pdf-parse handle?
Breadth from one parser is its main asset. A single PDFParse instance offers getText for the listing copy, getTable for a room-size grid, getScreenshot for a page thumbnail and getInfo for metadata, beside getImage. Each extracted image carries width, height, kind and name with its bytes, so a size rule of the caller's own can run after extraction, and the dataUrl is ready to place in a web page as it arrives.
The imageBuffer and imageDataUrl options switch either output off, which spares a file-writing job the base64 strings, and partial: [2, 4] limits any call to those pages. A brochure protected with a password is opened by passing it at load time, a wrong one raises a dedicated PasswordException, and the package loads through require or import, runs in a browser bundle and includes a command-line tool.
A two-page test brochure
- One logo under 80 pixels, repeated on both pages.
- One badge smaller still, placed in the footer.
- Two photographs per page at full size.
- A count of the images an auditor would expect, written down before either library runs.
Our check of the IronPDF calls used the typedoc pages as published on 3 December 2026, the day npm showed 2026.12.1 as the newest @ironsoftware/ironpdf version, and the test brochure above is the file to run through extractRawImages first, with the buffer count compared against the written-down total. The IronPDF for Node.js licensing page issues the key that the brochure test needs.
pdf-parse, @napi-rs/canvas and Node.js are trademarks or works of their respective owners, we have no affiliation with any of them, and the facts above are based on the pdf-parse source, README, option reference and troubleshooting guide at version 2.4.5, npm records and the IronPDF for Node.js API reference.
Top comments (0)