fdf-tools
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

fdf-tools

A tiny package to create fdf (Forms data format) files.

Install

npm i fdf-tools

Usage

  1. You need a fillable pdf.

  2. Get field names of the pdf form

pdftk [pdf_name] dump_data_fields
  1. Create fdf file using this package, let's assume your pdf form has fields "Name", "Address" and "Age":
import { createFdf } from 'fdf-tools';
import fs from 'fs';

const formData = {
  Name: "John Doe",
  Address: "132, My Street, Kingston, New York 12401.",
  Age: "25",
};

const fdfData = createFdf(formData);

// Save the FDF data to a file
fs.writeFileSync("form_data.fdf", fdfData);
console.log("FDF file created successfully.");
  1. Then this fdf can be used to auto-fill the pdf form using pdftk
pdftk pdf_form.pdf fill_form form_data.fdf output resulting_pdf.pdf flatten

the end result form will be in resulting_pdf.pdf which is filled out and flattened (no longer editable)

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.11latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.11
1.0.01

Package Sidebar

Install

npm i fdf-tools

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

4.14 kB

Total Files

8

Last publish

Collaborators

  • prkagrawal