Szpadel / chrome-headless-render-pdf

225 stars 67 forks source link

Extra page on generation #23

Open mackensen opened 6 years ago

mackensen commented 6 years ago

I've noticed that if I pass the --no-margins parameter I get a second, blank page on the generated PDF.

seveibar commented 6 years ago

I've also had this issue, but not consistently across all my pages. I speculated that it might be caused by "one extra pixel" on the bottom of the page, so make sure you're not taking up too much room.

My solution to this in the mean time is to call out to pdftk to cut out all but the first page of the pdf.

pdftk rendered.pdf cat 1 output singlePagePDF.pdf

mackensen commented 6 years ago

@seveibar that's been my workaround as well, and it's working fine.

Szpadel commented 6 years ago

I'm not able to fix that, because splitting page to pages in internal chrome logic, and I have no control over that, but to make your live easier, I implemented --page-ranges, so you don't need any external tools to work around that. Please also check if upgrading chrome makes a difference, because I wasn't able to find any page with that behavior using 67.0.3386.1