0.2.3 • Published 5 years ago

larviturltopdf v0.2.3

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

Build Status Dependencies

larviturltopdf

Render an URL to a PDF using phantomjs.

Example usage:

'use strict';

const urltopdf = require('larviturltopdf'),
      fs       = require('fs');

urltopdf('http://www.fsf.org/', function(err, pdfBuffer) {
	if (err) throw err;

	// Write to disk
	fs.writeFile('output.pdf', pdfBuffer, function(err) {
		if (err) throw err;

		console.log('done');
	});
});

Wait for dynamic content

In case javascript is used to alter the DOM, you can tell the renderer to wait until the class "html-ready" exists in the body tag.

'use strict';

const urltopdf = require('larviturltopdf'),
      fs       = require('fs');

urltopdf({'url': 'http://www.fsf.org/', 'waitForHtmlReadyClass': true}, function(err, pdfBuffer) {
	if (err) throw err;

	// Do something with pdfBuffer
});

Custom execFile options

You can pass an optional object as execOptions property with options for the execFile.

'use strict';

const urltopdf = require('larviturltopdf'),
      fs       = require('fs');

urltopdf({'url': 'http://www.fsf.org/', execOptions: {'maxBuffer': 500 * 1024}}, function(err, pdfBuffer) {
	if (err) throw err;

	// Do something with pdfBuffer
});
0.2.3

5 years ago

0.2.2

6 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

8 years ago

0.0.1

8 years ago