https://github.com/cityssm/pdf-form-extract
Extracts PDF form fields into a Javascript object
https://github.com/cityssm/pdf-form-extract
forms pdf pdf-extracting pdf-forms
Last synced: 3 months ago
JSON representation
Extracts PDF form fields into a Javascript object
- Host: GitHub
- URL: https://github.com/cityssm/pdf-form-extract
- Owner: cityssm
- License: mit
- Created: 2023-01-13T16:42:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-10T03:04:59.000Z (about 2 years ago)
- Last Synced: 2025-02-19T13:47:01.143Z (4 months ago)
- Topics: forms, pdf, pdf-extracting, pdf-forms
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@cityssm/pdf-form-extract
- Size: 428 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# PDF Form Extract
[](https://www.npmjs.com/package/@cityssm/pdf-form-extract)
[](https://www.codacy.com/gh/cityssm/pdf-form-extract/dashboard?utm_source=github.com&utm_medium=referral&utm_content=cityssm/pdf-form-extract&utm_campaign=Badge_Grade)
[](https://codeclimate.com/github/cityssm/pdf-form-extract/maintainability)
[](https://codeclimate.com/github/cityssm/pdf-form-extract/test_coverage)
[](https://github.com/cityssm/pdf-form-extract/actions/workflows/coverage.yml)
[](https://app.snyk.io/org/cityssm/project/78ebff99-06fc-4153-a2c8-ccededba162e)Extracts PDF form fields into a Javascript object.
## Installation
npm install @cityssm/pdf-form-extract
## Usage

```javascript
import extractFormFields from "@cityssm/pdf-form-extract"const data = await extractFormFields('test/testForm.pdf')
console.log(data)const dataWithOptions = await extractFormFields('test/testForm.pdf', { useFieldName: true })
``````json
{
"Contractor Firm Name": "The City of Sault Ste. Marie",
"Address": "https://github.com/cityssm/pdf-form-extract",
"Contractor Representative Print Name": "Dan Gowans",
"Date": "2023-01-13"
}
```### Optional Options
**useFieldName**
_Default = false_
Uses the field name (provided by the Form API) as the Object key
instead of the field key.## Notes
For the best results, the form fields in the PDF should be properly labelled.