@superxepic/formghost
v1.0.2
Published
PDFs keep secrets. FormGhost doesn't. Extract form fields from PDFs into clean JSON — zero native dependencies.
Maintainers
Readme
👻 @superxepic/formghost
PDFs keep secrets. FormGhost doesn't.
Zero native dependencies. Pure JS/TS PDF form field extractor. Works in Node.js 18+.
Install
npm install @superxepic/formghostUsage
Programmatic
import { extract, extractValues, extractNames } from "@superxepic/formghost";
import { readFileSync } from "fs";
const buf = readFileSync("application.pdf");
// Full extraction
const { fields, pageCount, meta } = await extract(buf);
// Just name → value pairs
const values = await extractValues(buf);
// { firstName: "Jane", agreed: true, country: "US" }
// Just field names (for building templates)
const names = await extractNames(buf);CLI
npx formghost form.pdf
npx formghost form.pdf --values-only
npx formghost form.pdf --types text,checkbox --output fields.json
npx formghost form.pdf --pages 0,1Field shape
{
"name": "address.city",
"label": "City",
"type": "text",
"value": "New York",
"required": true,
"readOnly": false,
"hidden": false,
"maxLength": 100,
"options": null,
"page": 2,
"rect": [72, 600, 300, 620]
}Supported field types
text · password · textarea · checkbox · radio · dropdown · listbox · button · signature
Options
| Option | Type | Description | | ---------------- | ----------- | -------------------------------------------- | | pages | number[] | Only extract from these 0-based page numbers | | types | FieldType[] | Filter by field type | | includeAnonymous | boolean | Include unnamed widget annotations | | password | string | Decrypt password-protected PDFs |
License
MIT © superxepic
