JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 502
  • Score
    100M100P100Q102226F

Fill PDF forms and return rendered PDF in buffer. No temporary files created.

Package Exports

  • pdf-fill-form

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pdf-fill-form) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme


pdf-fill-form is Node.js native C++ library for filling PDF forms. Created PDF file is returned back as Node.js Buffer object for further processing or saving - whole process is done in memory. Library offers methods to return filled PDF also as PDF file where pages are converted to images.

Libary uses internally Poppler QT4 for PDF form reading and filling. Cairo is used for PDF creation from page images (when parameter { "save": "imgpdf" } is used). ##Examples To read all form fields:

var pdfFillForm = require('pdf-fill-form');

var pdfFields = pdfFillForm.readSync('test.pdf');
console.log(pdfFields);

To write form fields (synchronous) to PDF:

var pdfFillForm = require('pdf-fill-form');
var fs = require('fs');

// Use here the field names you got from read
var pdf = pdfFillForm.writeSync('test.pdf', 
    { "myField": "myField fill value" }, { "save": "pdf" } );
fs.writeFileSync('filled_test.pdf', pdf);

To write form fields (aynchronous) to PDF:

var pdfFillForm = require('pdf-fill-form');
var fs = require('fs');

// Use here the field names you got from read
pdfFillForm.writeAsync('test.pdf', 
    { "myField": "myField fill value" }, { "save": "pdf" }, 
    function(err, pdf) {
        fs.writeFile("filled_test.pdf", pdf, function(err){});
    }
);

To write form fields to PDF where pages are converted to images:

Use parameter { "save": "imgpdf" }

##Installation

###OS X Preferable method to install library dependencies is via Homebrew

$ brew install cairo poppler

After dependencies are successfully installed, you can install the library:

$ npm install pdf-fill-form

Homebrew users who get error regarding xcb-shm
The fix is to add this to your bash profile / environment: export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

###Linux (Ubuntu/Debian)

$ sudo apt-get install libpoppler-qt4-dev libcairo2-dev
$ npm install pdf-fill-form

##Todo

  • Tests
  • Refactoring

##Authors

License

MIT

NOTE ABOUT LIBRARY DEPENDENCIES!
Poppler has GPL license. Cairo has LGPL.