Scan your whole stack
From OX Research Newsroom
Are you using @d0paminedriven/pdfdown?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.22.0
@d0paminedriven/pdfdown was last scanned on 28 Nov 2026 at version 0.22.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.22.0 LATEST | 28 Nov 2026 | No rules fired |
| 0.21.0 | 27 Nov 2026 | No rules fired |
| 0.20.0 | 22 Nov 2026 | No rules fired |
| 0.19.0 | 20 Nov 2026 | Not shown |
| 0.18.0 | 19 Nov 2026 | Not shown |
Findings for v0.22.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.22.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Rust-powered PDF extraction for Node.js via napi-rs. Extracts per-page text, positioned words and lines, images (as PNG), annotations (links, destinations), structured text (with header/footer detection), AcroForm fields (read-only, one entry per widget placement), embedded files, invoice fields, and metadata with each page size and the paper it is nearest to, from PDF buffers. Pages can also be rendered to PNG on a host that has PDFium. All extraction is parallelized with rayon for multi-core performance.
An OCR variant is available as @d0paminedriven/pdfdown-ocr for image-only PDF pages (scanned documents, embedded screenshots). It includes all of the APIs below plus Tesseract-based OCR fallback.
npm install @d0paminedriven/pdfdown
yarn add @d0paminedriven/pdfdown
pnpm add @d0paminedriven/pdfdown
node ≥ 24. The package is an ES module.
export declare function extractTextPerPage(buffer: Buffer): Array<PageText>;
export declare function extractStructuredTextPerPage(
buffer: Buffer
): Array<StructuredPageText>;
export declare function layoutPerPage(buffer: Buffer): Array<PageLayout>;
export declare function extractImagesPerPage(buffer: Buffer): Array<PageImage>;
export declare function extractAnnotationsPerPage(
buffer: Buffer
): Array<PageAnnotation>;
export declare function extractFormFieldsPerPage(
buffer: Buffer
): Array<PageFormField>;
export declare function attachments(buffer: Buffer): Array<Attachment>;
export declare function extractInvoice(
buffer: Buffer,
opts?: InvoiceOptions
): InvoiceResult;
export declare function invoiceFromLayout(
pages: Array<PageLayout>,
opts?: InvoiceOptions
): InvoiceResult; // the engine on pages from anywhere
export declare function pdfImageCount(buffer: Buffer): number; // the images the pages paint, counted without decoding
export declare function pdfMetadata(buffer: Buffer): PdfMeta;
export declare function pdfDocument(buffer: Buffer): PdfDocument;
export declare function capabilities(): Capabilities; // what this build and this host can do
Each sync function that takes a buffer has an async counterpart that runs on the libuv thread pool, keeping the main thread free. Rendering is async only.
export declare function extractTextPerPageAsync(
buffer: Buffer
): Promise<Array<PageText>>;
export declare function extractStructuredTextPerPageAsync(
buffer: Buffer
): Promise<Array<StructuredPageText>>;
export declare function layoutPerPageAsync(
buffer: Buffer
): Promise<Array<PageLayout>>;
export declare function extractImagesPerPageAsync(
buffer: Buffer
): Promise<Array<PageImage>>;
export declare function extractAnnotationsPerPageAsync(
buffer: Buffer
): Promise<Array<PageAnnotation>>;
export declare function extractFormFieldsPerPageAsync(
buffer: Buffer
): Promise<Array<PageFormField>>;
export declare function attachmentsAsync(
buffer: Buffer
): Promise<Array<Attachment>>;
export declare function extractInvoiceAsync(
buffer: Buffer,
opts?: InvoiceOptions
): Promise<InvoiceResult>;
export declare function invoiceFromLayoutAsync(
pages: Array<PageLayout>,
opts?: InvoiceOptions
): Promise<InvoiceResult>;
export declare function pdfImageCountAsync(buffer: Buffer): Promise<number>;
export declare function pdfMetadataAsync(buffer: Buffer): Promise<PdfMeta>;
export declare function pdfDocumentAsync(buffer: Buffer): Promise<PdfDocument>;
export declare function renderPagesAsync(
buffer: Buffer,
opts?: RenderOptions
): Promise<Array<RenderedPage>>;
PdfDown classParse once, call many. The constructor parses the PDF once and reuses it across all sync method calls; openAsync does the same parse off the JavaScript thread. Async methods share the parsed document across worker threads via Arc (atomic reference counting) with zero re-parsing overhead.
export declare class PdfDown {
constructor(buffer: Buffer);
static openAsync(buffer: Buffer): Promise<PdfDown>;
textPerPage(): Array<PageText>;
structuredText(): Array<StructuredPageText>;
layout(): Array<PageLayout>;
imagesPerPage(): Array<PageImage>;
imageCount(): number; // counted without decoding
annotationsPerPage(): Array<PageAnnotation>;
formFieldsPerPage(): Array<PageFormField>;
attachments(): Array<Attachment>;
invoice(opts?: InvoiceOptions): InvoiceResult;
metadata(): PdfMeta;
document(): PdfDocument;
textPerPageAsync(): Promise<Array<PageText>>;
structuredTextAsync(): Promise<Array<StructuredPageText>>;
layoutAsync(): Promise<Array<PageLayout>>;
imagesPerPageAsync(): Promise<Array<PageImage>>;
imageCountAsync(): Promise<number>;
annotationsPerPageAsync(): Promise<Array<PageAnnotation>>;
formFieldsPerPageAsync(): Promise<Array<PageFormField>>;
attachmentsAsync(): Promise<Array<Attachment>>;
invoiceAsync(opts?: InvoiceOptions): Promise<InvoiceResult>;
metadataAsync(): Promise<PdfMeta>;
documentAsync(): Promise<PdfDocument>;
renderPagesAsync(opts?: RenderOptions): Promise<Array<RenderedPage>>;
}
export interface PageText {
page: number;
text: string;
}
export interface StructuredPageText {
page: number;
header: string;
body: string;
footer: string;
}
// Positioned text. All coordinates are PDF user space in points, y up,
// exactly as the content stream placed them (not shifted to the CropBox
// origin, not rotated by /Rotate).
export interface PageLayout {
page: number;
width: number; // CropBox (fallback MediaBox) size in points
height: number;
rotate: number; // /Rotate, reported and not applied
contentRotation: number; // 0 | 90 | 180 | 270: the page frame's turn, the one carrying the most confident OCR text across its images; words, lines and images all share it; the render tier's turn includes /Rotate (always 0 for Native). Displayed coordinates = this frame turned by rotate - contentRotation
source: TextSource; // "Native" here; "Ocr" | "Rendered" from the OCR package: the deepest cascade tier that ran, native words kept alongside
words: Array<TextWord>;
lines: Array<TextLine>;
images: Array<PlacedImage>;
warnings: Array<string>;
}
export interface TextWord {
text: string;
x0: number;
y0: number;
x1: number;
y1: number;
line: number; // index into PageLayout.lines
fontSize?: number; // native only: size in points after the CTM
fontName?: string; // native only: base font, subset prefix stripped
bold?: boolean; // native only: name, ForceBold flag or FontWeight >= 600; absent when the font gives no weight evidence (anonymous CIDFont+Fn names)
italic?: boolean;
symbolic?: boolean; // native only: set in a barcode font, so the glyphs are bars, not letters
confidence?: number; // OCR only: 0..1
}
export interface TextLine {
text: string; // words joined by single spaces
x0: number;
y0: number;
x1: number;
y1: number;
firstWord: number; // PageLayout.words[firstWord .. firstWord + wordCount) are this line's words
wordCount: number;
}
export interface PlacedImage {
xobjectName: string; // matches PageImage.xobjectName
x0: number;
y0: number;
x1: number;
y1: number;
}
export type TextSource = "Native" | "Ocr" | "Rendered";
export interface PageImage {
page: number;
imageIndex: number;
width: number;
height: number;
data: Buffer; // PNG-encoded bytes
colorSpace: string;
bitsPerComponent: number;
filter: string;
xobjectName: string;
objectId: string;
}
export interface PageAnnotation {
page: number;
subtype: string; // "Link", "Text", "Highlight", etc.
rect: Array<number>; // [x1, y1, x2, y2] bounding box
uri?: string; // external link URL
dest?: string; // internal named destination
content?: string; // tooltip / alt text
}
export type BoxType = "CropBox" | "MediaBox" | "Unknown";
export interface PageBox {
pageCount: number; // number of pages with these dimensions
left: number;
bottom: number;
right: number;
top: number;
width: number;
height: number;
boxType: BoxType;
paperSize: PaperSize; // the standard paper size nearest to width by height, in either orientation
pages?: Array<number>; // only present on non-dominant entries
}
// A union keyed on `type`, spelled the way a database enum spells it. A standard size
// carries the standard's own dimensions in points, portrait: `width` is the short side.
// Abridged here: there is one member for each of A0 to A10, B0 to B10, LETTER, LEGAL,
// TABLOID, EXECUTIVE and STATEMENT.
export type StandardPaperSize =
| { type: "A4"; width: number; height: number }
| { type: "LETTER"; width: number; height: number };
// `UNKNOWN` when no standard size is within 3% on both sides. `closestTo` names the standard
// sizes the page lies between by area: the largest one no larger than the page, then the
// smallest one larger. A side is null when the page is past that end of the list.
export type PaperSize =
| StandardPaperSize
| {
type: "UNKNOWN";
closestTo: [
StandardPaperSize | null | undefined,
StandardPaperSize | null | undefined
];
};
export interface PdfMeta {
pageCount: number;
version: string;
isLinearized: boolean;
creator?: string;
producer?: string;
creationDate?: string;
modificationDate?: string;
title?: string; // what the document says of itself, as the file writes it
author?: string;
subject?: string;
keywords?: string; // one string, usually a list separated by commas or semicolons
language?: string; // the language the catalog names for the text: en-US
isEncrypted: boolean; // encrypted on disk, whether or not it opened without a password
pageBoxes: Array<PageBox>;
form?: FormInfo; // present when /AcroForm exists or orphan widgets were found
}
export interface PdfDocument {
version: string;
isLinearized: boolean;
pageCount: number;
creator?: string;
producer?: string;
creationDate?: string;
modificationDate?: string;
title?: string; // what the document says of itself, as the file writes it
author?: string;
subject?: string;
keywords?: string; // one string, usually a list separated by commas or semicolons
language?: string; // the language the catalog names for the text: en-US
isEncrypted: boolean; // encrypted on disk, whether or not it opened without a password
pageBoxes: Array<PageBox>;
totalImages: number;
totalAnnotations: number;
imagePages: Array<number>;
annotationPages: Array<number>;
text: Array<PageText>;
structuredText: Array<StructuredPageText>;
images: Array<PageImage>;
annotations: Array<PageAnnotation>;
form?: FormInfo;
formFields: Array<PageFormField>; // one entry per widget placement, sorted by page
totalFormFields: number; // === formFields.length
formFieldPages: Array<number>; // sorted unique pages carrying widgets
}
export interface Capabilities {
ocr: boolean; // false in this package; true in @d0paminedriven/pdfdown-ocr
render: boolean; // PDFium was found on this host
}
export type RenderMode = "Auto" | "Never" | "Always";
export interface RenderOptions {
dpi?: number; // default 300, clamped to 72..600
mode?: RenderMode; // default "Always"
}
export interface RenderedPage {
page: number;
width: number; // pixels
height: number;
dpi: number;
data: Buffer; // PNG-encoded bytes
}
PageFormField is a discriminated union keyed by type: one entry per widget placement, so a field shown on two pages yields two entries and a radio group yields one entry per option. Join placements of one logical field on fieldObjectId. Presentation data (/DA, /Q, /MK, appearance streams) is deliberately not surfaced: pdfdown reports field data and geometry, never how a viewer should draw it, and it never writes to a form.
export type PageFormField =
| {
type: "Text";
/* common */ multiline: boolean;
password: boolean;
comb: boolean;
richText: boolean;
maxLen?: number;
}
| {
type: "Checkbox";
/* common */ onState?: string;
exportValue?: string;
checked: boolean;
}
| {
type: "Radio";
/* common */ onState?: string;
exportValue?: string;
selected: boolean;
}
| {
type: "ComboBox";
/* common */ options: Array<ChoiceOption>;
editable: boolean;
}
| {
type: "ListBox";
/* common */ options: Array<ChoiceOption>;
multiSelect: boolean;
values?: Array<string>;
}
| { type: "PushButton" /* common */ }
| { type: "Signature"; /* common */ signed: boolean } // signature data present in /V, not cryptographic validation
| { type: "Unknown" /* common */ }; // widget annotations no field claims (orphans, or no /AcroForm at all)
// "common" on every variant:
// page: number; // 1-based, like PageText / PageImage / PageAnnotation
// rect: Array<number>; // [x0, y0, x1, y1] PDF user space, same convention as PageAnnotation.rect
// objectId: string; // this widget, "N G obj" like PageImage.objectId ("page P annot I" for an inline dictionary)
// fieldObjectId: string; // the logical field; identical on every placement of one field
// name: string; // fully qualified "parent.kid"
// partialName: string; widgetIndex: number; widgetCount: number;
// value?: string; defaultValue?: string; tooltip?: string; mappingName?: string;
// readOnly: boolean; required: boolean; noExport: boolean; hasActions: boolean
export interface ChoiceOption {
exportValue: string;
displayValue: string;
}
export interface FormInfo {
hasAcroForm: boolean; // /AcroForm present (false when only orphan widgets were found)
hasXfa: boolean; // /XFA present; XFA is not parsed
needAppearances: boolean;
sigFlags: number;
fieldCount: number; // logical fields, placed + unplaced; may differ from totalFormFields
widgetCount: number; // placements; always equals totalFormFields
unplacedFields: Array<UnplacedFormField>; // fields with no widget on any page: data kept, no geometry invented
truncated: boolean; // the /Kids depth cap (100) was hit: the result is partial
warnings: Array<string>; // dangling references, non-array /Annots, non-dictionary /Kids entries, depth cap
}
export interface UnplacedFormField {
fieldObjectId: string;
name: string;
partialName: string;
type: PageFormField["type"];
value?: string;
values?: Array<string>;
defaultValue?: string;
tooltip?: string;
mappingName?: string;
options?: Array<ChoiceOption>;
maxLen?: number;
readOnly: boolean;
required: boolean;
noExport: boolean;
hasActions: boolean;
multiline: boolean;
password: boolean;
comb: boolean;
richText: boolean;
editable: boolean;
multiSelect: boolean;
signed: boolean;
}
Buttons keep the spec's two representations apart: onState is the appearance state name from the widget's /AP /N (absent, never invented, when there is no appearance dictionary) and exportValue is the /Opt entry that state maps to. checked / selected follow /AS, then /V; value always reports /V, so a stored value and an appearance state that disagree are both visible.
The declarations are self-contained: they import nothing and export only what the binding produces. The keyed views of the form-field union are a line each with @d0paminedriven/type-utils (or any equivalent helper):
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.