fdf-tools
v1.0.1
Published
A package to generate fdf (Forms data format) files
Downloads
13
Maintainers
Readme
fdf-tools
A tiny package to create fdf (Forms data format) files.
Install
npm i fdf-tools
Usage
You need a fillable pdf.
Get field names of the pdf form
pdftk [pdf_name] dump_data_fields
- 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.");
- 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)