1.0.1 • Published 10 months ago

pdf-phantom v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

Notice

Development on this project has been suspended due to lack of support for PhantomJs.

phantom - Fast NodeJS API for PhantomJS

NPM

NPM Version NPM Downloads Linux Build Node Version

Super easy to use

const phantom = require('pdf-phantom');

(async function() {
  const instance = await phantom.create();
  const page = await instance.createPage();
  await page.on('onResourceRequested', function(requestData) {
    console.info('Requesting', requestData.url);
  });

  const status = await page.open('https://stackoverflow.com/');
  const content = await page.property('content');
  console.log(content);

  await instance.exit();
})();

Using Node v7.9.0+ you can run the above example with node file.js

See examples folder for more ways to use this module.

Installation

Node v6.x and later

Latest version of phantom does require Node v6.x and later. You can install with

$ npm install pdf-phantom --save

Pooling

Creating new phantom instances with phantom.create() can be slow. If you are frequently creating new instances and destroying them, as a result of HTTP requests for example, it might be worth creating a pool of instances that are re-used.

See the phantom-pool module for more info.

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

Contributing

This package is under development. Pull requests are welcomed. Please make sure tests are added for new functionalities and that your build does pass in TravisCI.

1.0.1

10 months ago

1.0.0

10 months ago