Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not use Puppeteer #28

Open
csga5000 opened this issue Oct 25, 2018 · 1 comment
Open

Why not use Puppeteer #28

csga5000 opened this issue Oct 25, 2018 · 1 comment

Comments

@csga5000
Copy link

Hey Mixu, it seems like puppeteer would make this a lot simpler.

Something like this works for the same thing, and allows headers and footers. It uses puppeteer which is headless chrome developed by google.

Honestly, it seems superior, and more up to date. I wonder if you should just deprecate this package and recommend this in the readme.

const puppeteer = require('puppeteer');

(async() => {
	const browser = await puppeteer.launch();
	const page = await browser.newPage();
	await page.goto('file:///C:/dev/wkhtmltesting/page-full.html');
	await page.pdf({
		path: 'page-full-pupp.pdf',
		format: 'A4',
		displayHeaderFooter: true,
		headerTemplate: '<div></div>',
		footerTemplate: 
			'<div style="font-size: 12px; width: 100%; text-align: center; font-style: italic; padding-bottom: 0.5in; font-family: serif;">'+
				'Page <span class="pageNumber"></span>'+
			'</div>',
		margin: {
			top: '0.5in',
			bottom: '1.5in',
			left: '1in',
			right: '1in',
		}
	});

	await browser.close();
})();
@csga5000
Copy link
Author

I'm open if you have arguments to why it's not better though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant