Scan your whole stack
From OX Research Newsroom
Are you using ai-document-parser?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.3.111
ai-document-parser was last scanned on 23 Nov 2026 at version 0.3.111. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.3.111 LATEST | 23 Nov 2026 | No rules fired |
| 0.3.110 | 23 Nov 2026 | No rules fired |
| 0.3.109 | 5 Nov 2026 | No rules fired |
| 0.3.108 | 10 Aug 2026 | Not shown |
| 0.3.106 | 6 Aug 2026 | Not shown |
Findings for v0.3.111. 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.3.111; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
TypeScript library for parse / convert / edit / write of office documents — built for AI agents and Node apps.
npm install ai-document-parser
The package is ESM-only ("type": "module"). Import it with import { … } from 'ai-document-parser' — CommonJS require() is not supported. Node.js >= 22.13.0 is required.
import { parseDocument, convertDocument, editDocument, writeDocument } from 'ai-document-parser';
// Parse
const result = await parseDocument('report.docx', { output: 'text' });
// output: 'text' | 'structured' | 'ast' | 'chunks'
// Convert preserves structure where possible (headings, tables, emphasis)
const { value } = await convertDocument('report.docx', 'md');
const slides = await convertDocument('deck.pptx', 'md'); // ## Slide N …
// Surgical edit
await editDocument('contract.docx', {
type: 'docx',
op: 'replace',
oldString: 'Acme Corp',
newString: 'Beta LLC',
});
await editDocument('budget.xlsx', {
type: 'spreadsheet',
op: 'patchCells',
updates: [{ sheet: 'Q1', cell: 'B2', value: 1500 }],
});
// Create — plain paragraphs (markdown markers are literal text)
await writeDocument('memo.docx', {
type: 'docx',
content: 'Paragraph one\nParagraph two',
});
// Create — rich DOCX from markdown (lists, tables, headings, emphasis)
await writeDocument('report.docx', {
type: 'docx',
format: 'markdown',
content: '# Title\n\n- item\n\n| A | B |\n|---|---|\n| 1 | 2 |\n',
});
await writeDocument('out.pdf', {
type: 'pdf',
content: 'Текст с кириллицей',
title: 'Отчёт',
});
parseDocument(path, { output: 'structured' }) — paragraphs / sheet grids / pptx slidesgetCapabilities(format).editModes and choose surgical, patchCells, or explicit rewriteeditDocument(...) — targeted or structured changesPDF remains read/convert-only for writing (plain-text writeDocument). Scanned PDFs and raster images can be read via OCR when a Tesseract runtime is present — see OCR.
See docs/AGENT_GUIDE.md.
| Format | Parse | Convert | Edit operation (fidelity) | Write |
|---|---|---|---|---|
| docx | yes | md/html/text/chunks/docx/odt/rtf/epub | surgical replace/append; rewrite | plain / blocks / md |
| xlsx / xls | yes | csv/md/html/text/chunks | patchCells (surgical) | yes |
| pptx | yes | md/html/text/chunks | surgical replace | plain / blocks / md |
| text + OCR of empty pages | md/html/text/chunks | — | plain text | |
| images (png/jpg/tiff/gif/webp/bmp) | OCR text | md/html/text/chunks | — | — |
| md / html | yes | md/html/text/csv/chunks/docx/odt/rtf/epub | rewrite | via flow rewrite |
| csv | yes | md/html/text/csv/chunks/docx/odt/rtf/epub | — | — |
| legacy .doc | heuristic | md/html/text/chunks/docx/odt/rtf/epub | — | via convertDocToDocx |
| odt | yes | md/html/text/chunks/docx/odt/rtf/epub | surgical replace; rewrite | plain / blocks / md |
| ods | yes | csv/md/html/text/chunks | patchCells (rewrite) | — |
| odp | yes | md/html/text/chunks | — | — |
| rtf / epub | yes | md/html/text/chunks/docx/odt/rtf/epub | surgical replace; rewrite | plain / blocks / md |
| legacy .ppt | — | — | — | — |
Notes:
.doc stay plain text (PDF may include OCR text).pdf is not supported (create PDF with writeDocument).pptx / pdf is not supported by design (create with writeDocument). Convert from pptx/odp is only md|html|text|chunks — pptx→docx is unsupported (not a host bug).options.sheet is passed (CSV_FIRST_SHEET message when defaulting).{ content } is plain paragraphs only; use { format: 'markdown', content } or { blocks } for headings/lists/tables/blockquotes. PPTX: #/## start a new slide; lists/tables round-trip structurally (list_item / table on parse). Inline/blockquote/code on PPTX are lossy and emit PPTX_* warnings on WriteResult.warnings.> blockquotes round-trip for docx/odt/rtf/epub.EditResult.mode is surgical when package markup is patched in place and rewrite when content is regenerated. ODS patchCells currently reports rewrite.getCapabilities() (CLI: capabilities) reports the exact per-format matrix.parseDocument already runs OCR when a Tesseract runtime is available:
png, jpg, tiff, gif, webp, bmp) are always OCR'd unless you pass ocr: false.enabled: 'auto'). Pass { enabled: true } to OCR every page, or ocr: false to skip OCR.The npm package does not ship the Tesseract binary or language data. Provide a runtime in one of these ways (first match wins):
{ bin, tessdataDir, popplerBin }ADP_TESSERACT, ADP_TESSDATA or TESSDATA_PREFIX, ADP_PDFTOPPMresources/ocr (Electron hosts can pack this as extraResources so process.resourcesPath/ocr resolves)tesseract (and for scanned PDFs, pdftoppm) on PATHBundled layout:
resources/ocr/bin/tesseract(.exe)
resources/ocr/tessdata/eng.traineddata
resources/ocr/tessdata/<lang>.traineddata
resources/ocr/bin/pdftoppm(.exe) (optional)
resources/ocr/lib/ (optional)
A bundled runtime is used only when the binary exists and every requested language has a *.traineddata file. Fetch official tessdata (and optionally copy a system binary) with:
node scripts/fetch-ocr-runtime.mjs --dry-run
node scripts/fetch-ocr-runtime.mjs --langs rus,eng
node scripts/fetch-ocr-runtime.mjs --langs deu,eng --set best
--set may be fast (default), best, or standard. Any Tesseract language id works — URLs are built from the official GitHub tessdata templates. --bin download --bin-url accepts a raw binary or an archive (zip, tar.*, 7z, NSIS, 7-Zip SFX); pass --bin-sha256 to verify the download. Scanned-PDF OCR also needs Poppler (pdftoppm). Poppler is GPL, so the script does not download it unless you pass --poppler-url. Image OCR works with Tesseract alone.
import { parseDocument, convertDocument, resolveOcrRuntime } from 'ai-document-parser';
import type { OcrOptions, OcrProvider } from 'ai-document-parser';
// Historical default (rus+eng, auto on empty PDF pages and images)
await parseDocument('scan.pdf');
await parseDocument('scan.pdf', { ocr: false });
await parseDocument('scan.de.pdf', {
ocr: {
languages: ['deu', 'eng'],
tessdataDir: '/usr/share/tesseract-ocr/5/tessdata',
},
});
// Custom engine (tesseract.js, a cloud API, …)
const provider: OcrProvider = {
async recognize({ imagePath, page }) {
const text = await myEngine(imagePath);
return { words: text ? [{ text, x: 0, y: 0, width: 1, height: 10, page }] : [] };
},
};
await parseDocument('scan.png', { ocr: { languages: ['eng'], provider } });
const runtime = resolveOcrRuntime({ languages: ['deu', 'eng'] });
Warnings such as OCR_LANG_MISSING, PDF_OCR_UNAVAILABLE, or IMAGE_OCR_USED are returned on DocumentResult.warnings (and on ConvertResult.messages when converting).
import { parseDocument } from 'ai-document-parser/parse';
import { convertDocument } from 'ai-document-parser/convert';
import { editDocument } from 'ai-document-parser/edit';
import { writeDocument } from 'ai-document-parser/write';
npx ai-document-parser read file.docx --output text
npx ai-document-parser read file.docx --output structured
npx ai-document-parser read scan.pdf --ocr-lang rus,eng
npx ai-document-parser read scan.pdf --no-ocr
npx ai-document-parser convert file.docx --to md -o out.md
npx ai-document-parser convert deck.pptx --to md -o slides.md
npx ai-document-parser edit file.docx --replace "old" "new"
npx ai-document-parser edit file.docx --replace "dup" "new" --all
npx ai-document-parser write-docx out.docx --content "Hello"
npx ai-document-parser write-xlsx out.xlsx --sheet Data --csv "a,b\n1,2"
npx ai-document-parser write-pdf out.pdf --content "Текст" --title "Отчёт"
npx ai-document-parser capabilities --format docx
MIT — see LICENSE and LICENSES.md.
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.