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

wkhtmltopdf stalls at page 36 of 78 #128

Open
rvwhitney opened this issue Dec 27, 2019 · 0 comments
Open

wkhtmltopdf stalls at page 36 of 78 #128

rvwhitney opened this issue Dec 27, 2019 · 0 comments

Comments

@rvwhitney
Copy link

rvwhitney commented Dec 27, 2019

UPDATE: this turns out to be an issue with the Linux binary (0.12.5)
we installed this on a Windows server - same setup otherwise - and it works fine.

I posted this in the wrong github yesterday.
Basically, I have a few pdf's to generate that are dying at a certain point - consistently.
Smaller pdf's generate just fine. I cannot figure out why this is happening.
Below is my code. I don't know if it has anything to do with the fact that I am using sockets?

```
    socket.on('make-pdf',function(data){
	console.log('DATA 2',data.html.length);

	var params = {
		pageSize: 'letter' ,
		footerHtml: data.footerHtml || '/pdf/footer/footer.html',
		footerRight: data.footerRight || 'Page [page] of [toPage]',
		footerLine: data.footerLine || true,
		headerHtml: data.headerHtml || '/pdf/header/header-' + data.header + '.html',
		headerSpacing: data.headerSpacing || 2,
		marginTop: data.marginTop || '3cm',
		marginBottom: data.marginBottom || '1cm',
		marginLeft: data.marginLeft || '1.25cm',
		marginRight: data.marginRight || '1.25cm',
		headerLine: data.headerLine || true,
		outline: data.outline || true,
		outlineDepth: data.outlineDepth || 4,
		javascriptDelay: 500,
		username: data.user,
		enableForms: data.enableForms || true,
		orientation: data.orientation || 'Portait',
		userStyleSheet: '/css/bootstrap.css',
		runScript: '/js/jquery-3.4.1.min.js'
	}
	console.log('params', params);
	console.log('end params');

	var pdf = wkpdf(data.html, params, function (err, stream){
	    console.log(stream);
	   // you can use message here and only in here

		if(err){
			console.log('ERROR IN WKPDF: ',err);
		} else {
			console.log('STREAM ERROR:',err, stream);
			toArray(stream, function (err, arr) {
				console.log('OUTPUT OF TO ARRAY',err,arr);
				var datas = {};
				datas.buffer = Buffer.concat(arr);
				datas.user = data.user;
				datas.filename = data.filename;
				socket.emit(data.returnEntry, datas);
			});
		}
	});
});

Any help is much appreciated.
Thank you!
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