Socket
Socket
Sign inDemoInstall

@creditiq/pdfform.js

Package Overview
Dependencies
3
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @creditiq/pdfform.js

Fill out PDF forms in pure JavaScript


Version published
Maintainers
1
Created

Readme

Source

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.

FAQs

Last updated on 28 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc