pdftohtmljs
PDF to HTML (pdf2htmlex) shell wrapper
Last updated 3 months ago by iapain .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pdftohtmljs 
SYNC missed versions from official npm registry.

pdftohtmljs - pdf2htmlEx shell wrapper for Node.js

view on npm npm module downloads Dependency Status Build Status Known Vulnerabilities view on npm

pdftohtmljs provides access to pdf2htmlEX via shell in node.js programs.

Requirements

If you've docker env setup, just install it via docker

alias pdf2htmlEX="docker run -ti --rm -v ~/pdf:/pdf iapain/pdf2htmlex pdf2htmlEX"

~/pdf on host computer will be used as volume

PDF2HTMLEX path is resolved usiing following:

  • first it looks into env variable PDF2HTMLEX_BIN.
  • then it fallbacks to bin option.
  • then it fallbacks to system path.

Installation

via npm:

npm install pdftohtmljs

Usage

const pdftohtml = require('pdftohtmljs')

// See presets (ipad, default)
// Feel free to create custom presets
// see https://github.com/fagbokforlaget/pdftohtmljs/blob/master/lib/presets/ipad.js
const convert = async (file, output, preset) => {
  const converter = new pdftohtml(file, output)

  // If you would like to tap into progress then create
  // progress handler
  converter.progress((ret) => {
    const progress = (ret.current * 100.0) / ret.total

    console.log(`${progress} %`)
  })

  try {
    // convert() returns promise
    await converter.convert(preset || 'ipad')
  } catch (err) {
    console.error(`Psst! something went wrong: ${err.msg}`)
  }

}

// call method
convert('test/pdfs/sample.pdf', 'sample.html')

Command line usage

npm install pdftohtmljs -g
pdftohtmljs sample.pdf

You may optionally provide your own filename and preset

pdftohtmljs sample.pdf sample.html ipad

Tests

$ npm test

NodeJS Support

This library support nodejs v8+

Current Tags

  • 0.6.0                                ...           latest (3 months ago)

19 Versions

  • 0.6.0                                ...           3 months ago
  • 0.5.4                                ...           3 months ago
  • 0.5.3                                ...           a year ago
  • 0.5.2                                ...           2 years ago
  • 0.5.1                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.2                                ...           4 years ago
  • 0.4.1                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.3.7                                ...           5 years ago
  • 0.3.6                                ...           5 years ago
  • 0.3.5                                ...           7 years ago
  • 0.3.4                                ...           7 years ago
  • 0.3.3                                ...           7 years ago
  • 0.3.2                                ...           7 years ago
  • 0.2.1                                ...           7 years ago
  • 0.2.0                                ...           7 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (2)
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 0
Last Month 11
Dependencies (0)
None
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |