1.0.14 • Published 5 years ago

pdfform.js v1.0.14

Weekly downloads
1,865
License
Apache-2.0
Repository
github
Last release
5 years ago

pdfform.js

Fill out PDF forms in pure JavaScript, both in the browser or on the server.

pdfform.js can function with a slightly customized version of pdf.js. However, due to the size and scope of PDF.js (1600KB+), by default a built-in PDF library (called minipdf) is used.

The online demo demonstrates both (not recommended in actual production).

Installation

To use in a browser, download and serve either pdfform.minipdf.dist.js (minipdf, recommended) or pdfform.pdf_js.dist.js (pdf.js).

Alternatively, download/clone this repository and add minipdf.js and pdfform.js to your JavaScript files. You'll also need the pako library.

Usage

Simply call transform with the PDF file contents and the fields.

<!-- download from https://raw.githubusercontent.com/phihag/pdfform.js/dist/dist/pdfform.minipdf.dist.js -->
<script src="downloaded/pdfform.minipdf.dist.js"></script>
<script>
var pdf_buf = ...; // load PDF into an ArrayBuffer, for example via XHR (see demo)
var fields = {
    'fieldname': ['value for fieldname[0]', 'value for fieldname[1]'],
};
var out_buf = pdfform().transform(pdf_buf, fields);
// Do something with the resulting PDF file in out_buf
</script>

There is also a list_fields function which allows you to list all available fields and their types.

For more details, have a look at the demo and its JavaScript code.

1.0.14

5 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago