filepond-plugin-pdf-convert
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

PDF convert to image plugin for FilePond

License: MIT npm version

The PDF Convert plugin is an Extenxion of FilePond that will convert a PDF file into an image. It will use library PDF.js.

Quick Start

Requirement:

Install using npm:

npm install filepond-plugin-pdf-convert

Or install using Yarn:

yarn add filepond-plugin-pdf-convert

Or using a CDN refernce:

https://unpkg.com/filepond-plugin-pdf-convert/dist/filepond-plugin-pdf-convert.min.js

Then import in your project:

import * as FilePond from "filepond";
import FilePondPluginPdfConvert from "filepond-plugin-pdf-convert";

Or reference it by CDN

<script src="https://unpkg.com/filepond-plugin-pdf-convert/dist/filepond-plugin-pdf-convert.min.js"></script>

Register the plugin:

FilePond.registerPlugin(FilePondPluginPdfConvert);

Create a new FilePond instance as normal.

const pond = FilePond.create({
  name: "filepond",
});

// Add it to the DOM
document.body.appendChild(pond.element);

The conversion will become active when uploading a PDF file.

Change the defaults

If you want you can change the defaults for this plugin

in the javascript

pond.setOptions({
    pdfConvertType: 'image/png',
    pdfConvertMarginHeight: 60
 });

or in the html with the 'data-' atributes in the html tag

<input type="file"
    data-pdf-convert-type="image/png"
    data-pdf-convert-margin-height="60"
/>

View the demo

Readme

Keywords

Package Sidebar

Install

npm i filepond-plugin-pdf-convert

Weekly Downloads

169

Version

1.0.3

License

MIT

Unpacked Size

16.3 kB

Total Files

7

Last publish

Collaborators

  • alexandredavid