Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 27 days 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 (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-10T03:04:59.000Z (over 1 year ago)
- Last Synced: 2024-08-10T19:23:02.699Z (5 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
[![npm (scoped)](https://img.shields.io/npm/v/@cityssm/pdf-form-extract)](https://www.npmjs.com/package/@cityssm/pdf-form-extract)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/233ab487462d4133aa5313fa1a61660b)](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)
[![Maintainability](https://api.codeclimate.com/v1/badges/c4a35e18908c159ecb88/maintainability)](https://codeclimate.com/github/cityssm/pdf-form-extract/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/c4a35e18908c159ecb88/test_coverage)](https://codeclimate.com/github/cityssm/pdf-form-extract/test_coverage)
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/cityssm/pdf-form-extract/coverage.yml)](https://github.com/cityssm/pdf-form-extract/actions/workflows/coverage.yml)
[![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/cityssm/pdf-form-extract)](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
![PDF Screenshot](test/testForm.png)
```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.