Skip to content

A tiny package to create FDF (Forms Data Format) files.

License

Notifications You must be signed in to change notification settings

prkagrawal/fdf-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

A tiny package to create FDF (Forms Data Format) files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published