Open antiframes opened 6 years ago
same problem for me. I am sending my entire html into node api which uses html-pdf to generate pdf. In local its works like charm. But after deployment my pdf looks weired. Fonts are too bigger and alignment is all gone.
I got the same issue, not sure need any configuration in server?
Ive got the same issue. A blank pdf is generated when piping to client side. Is there a way to compress the stream before piping?
Ive got the same issue. A blank pdf is generated when piping to client side. Is there a way to compress the stream before piping?
I had an issue where the PDF was corrupted during output from server to client. I managed to fix it by adding a gzip transform pipe prior to piping to res
.
Here's the gist:
const { createGzip } = require('zlib')
res.writeHead(200, {
'Content-Type': 'application/pdf; charset=utf-8',
'Content-Disposition': 'attachment; filename=some_doc.pdf;',
'Content-Encoding': 'gzip'
})
pdf.create(html, options).toStream((err, stream) => {
if (err) {
console.log(err)
return res.sendStatus(500)
} else {
stream.pipe(createGzip()).pipe(res)
}
})
I am developing a nodejs application which works fine when I run on localhost, but I get a blank PDF after uploading it to AWS serverless. That's my code:
pdf.create(html,{"format": "A4"}).toStream(function(err, stream){ res.writeHead(200, {"Content-type": "application/pdf"}); stream.pipe(res); });
It's not actually a blank PDF, but the content is considerably different. The same thing happens if I choose buffer instead of stream.