JSPM

  • Created
  • Published
  • Downloads 5021
  • Score
    100M100P100Q128251F
  • License ISC

PDF to HTML conversion using Apache Tika. Also generate PDF thumbnail using Apache PDFBox.

Package Exports

  • pdf2html

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 (pdf2html) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pdf2html

NPM version npm module downloads view on npm

pdf2html helps to convert PDF file to HTML pages using Apache Tika. This module also helps to generate thumbnail image for PDF file using Apache PDFBox.

Installation

via npm:

npm install --save pdf2html

Java runtime environment (JRE) is required to run this module.

Usage

const pdf2html = require('pdf2html')

pdf2html.html('sample.pdf', (err, html) => {
    if (err) {
        console.error('Conversion error: ' + err)
    } else {
        console.log(html)
    }
})

Convert as pages

const pdf2html = require('pdf2html')

pdf2html.pages('sample.pdf', { text: true }, (err, text) => {
    if (err) {
        console.error('Conversion error: ' + err)
    } else {
        console.log(text)
    }
})

Convert to text

const pdf2html = require('pdf2html')

pdf2html.text('sample.pdf', (err, text) => {
    if (err) {
        console.error('Conversion error: ' + err)
    } else {
        console.log(text)
    }
})

Extra metadata

const pdf2html = require('pdf2html')

pdf2html.meta('sample.pdf', (err, meta) => {
    if (err) {
        console.error('Conversion error: ' + err)
    } else {
        console.log(meta)
    }
})