Giter Site home page Giter Site logo

pdfform.js's Introduction

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.

pdfform.js's People

Contributors

phihag avatar marvinhagemeister avatar

Watchers

 avatar

Forkers

linedotstar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.