2.0.3 • Published 11 months ago

htmltar-to-pdf v2.0.3

Weekly downloads
6
License
UNLICENSED
Repository
github
Last release
11 months ago

Build Status Coverage Status Version License Code style

Motivation

htmltar-to-pdf is a wrapper around phantomjs that convert a HTML payload (in a tarball) as a PDF (or png) file.

Using a simple tar as input makes the whole API simple & stable.

API/usage

const html2pdf = require('htmltar-to-pdf');
const infile  = '/some/path/to/a/file.tar';

let output_path = await html2pdf(infile, [format = "pdf|png", [options ]]); //will capture (index.html in tar file)


//you wont make it any simplier...
console.log("Please find a fine PDF in", output_path);

Configuration parameters & defaults values

  let opts = {
    format         : 'A4',
    orientation    : 'portrait || landscape',
    dpi            : 72,
    index          : 'index.html',

    waitForDom     : true,
    waitForEvent   : 'customPageEvent',
    waitForTimeout : 5000 // timeout as ms

     //configure one will set up #page-footer #page-header
    pageBodyAnchor : null,
    footerFile     : null,
    headerFile     : null,
  };

Credits

2.0.3

11 months ago

2.0.2

11 months ago

2.0.1

11 months ago

1.3.2

2 years ago

1.3.1

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.9.0

5 years ago