# form-pdf2json

> NodeJS library to convert pdf to json or vice versa

Latest version **0.1.6** (published 2021-02-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install form-pdf2json
pnpm add form-pdf2json
yarn add form-pdf2json
bun add form-pdf2json
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2021-02-26 |
| First published | 2019-09-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 16.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | ClareKang |
| Maintainers | clarekang89 |
| Keywords | pdf, json, nodejs, pdftk, fdf, pdf filler, pdf parser, pdf to json, json to pdf |

## Links

- npm: https://www.npmjs.com/package/form-pdf2json
- Repository: https://github.com/ClareKang/form-pdf2json
- Homepage: https://github.com/ClareKang/form-pdf2json#readme
- Issues: https://github.com/ClareKang/form-pdf2json/issues
- npm.io page: https://npm.io/package/form-pdf2json

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [change-case](https://npm.io/package/change-case.md) ^3.1.0
- [utf8-fdf-generator](https://npm.io/package/utf8-fdf-generator.md) 0.0.3

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.6 (latest) — 2021-02-26
- 0.1.5 — 2019-11-07
- 0.1.4 — 2019-09-17
- 0.1.3 — 2019-09-17
- 0.1.2 — 2019-09-17
- 0.1.1 — 2019-09-17
- 0.1.0 — 2019-09-17

## README

# Form PDF2JSON

![NPM](https://img.shields.io/npm/l/form-pdf2json?style=flat)
![GitHub package.json version](https://img.shields.io/github/package-json/v/ClareKang/form-pdf2json?style=flat&logo=github)

NodeJS library to convert JSON to PDF or vice versa (JSON to PDF or PDF to JSON)

Inspired from [pdffiller](https://github.com/pdffillerjs/pdffiller).

- [Requirements](#requirements)
  - [Installation](#installation)
- [Definition](#definition)
- [Usage](#usage)
- [Commands](#commands)
  - [Convert file to data](#convert-to-data)
    - [PDF to JSON](#pdf-to-json)
    - [JSON to FDF](#json-to-fdf)
  - [Export to file](#export-to-file)
    - [PDF to JSON](#pdf-to-json-1)
    - [PDF to FDF](#pdf-to-fdf)
    - [JSON to PDF](#json-to-fdf)

## Requirements

This is dependent on the PDF Toolkit library [PDF ToolKit](http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/)
So you should install PDF Toolkit first.

### Installation

```bash
// with npm
npm install --save-dev form-pdf2json

// with yarn
yarn add form-pdf2json
```

## Definition

| Name             | Desc                                                                | Misc                              |
| ---------------- | ------------------------------------------------------------------- | --------------------------------- |
| FieldType        | Form Field Type                                                     | One of `Text`, `Choice`, `Button` |
| FieldName        | Form Field Name                                                     | Unique                            |
| FieldStateOption | If `FieldType`is Button, actual value is `FieldStateOption's` value | -                                 |
| FieldValue       | -                                                                   | -                                 |

## Usage

```javascript
var pdf2json = require("form-pdf2json");

// or

import pdf2json from "form-pdf2json";

// => { convertPdf2Json: [Function], convertJson2Fdf: [Function], ... }
```

## Commands

### Convert to data

#### PDF to JSON

`convertPdf2Json`

```javascript
pdf2json.convertPdf2Json("path/to/file");
// returns json data
```

#### JSON to FDF

`convertJson2Fdf`

```javascript
pdf2json.convertJson2Fdf("path/to/file");
// returns fdf data
```

### Export to file

#### PDF to JSON

`exportPdf2Json`

```javascript
pdf2json.exportPdf2Json("path/to/file");
// export json file
```

#### JSON to PDF

`exportJson2Pdf`

```javascript
pdf2json.exportJson2Pdf("path/to/file");
// export json file
```

#### PDF to FDF

`exportPdf2Fdf`

```javascript
pdf2json.exportPdf2Fdf("path/to/file");
// export json file
```

## Contributions

Feel free to contribute by posting issues or pull requests on [form-pdf2json](https://github.com/ClareKang/form-pdf2json)

---
_Source: https://npm.io/package/form-pdf2json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
