spipu / html2pdf

OFFICIAL PROJECT | HTML to PDF converter written in PHP
http://html2pdf.fr/en/default
Open Software License 3.0
1.68k stars 751 forks source link

White space under a PDF after his generation in landscape mode #812

Open thm-meder opened 1 month ago

thm-meder commented 1 month ago

Hello everyone,

I'm writing this message after a problem encountered while creating a pdf with html2pdf.

To answer a need of one of our clients, we create the template of a pdf in css, then "take a snapshot" and create the pdf with html2pdf and jsPDF.

I portrait mode, there is no problem, but when you create a pdf in landsccape mode, a white area of about 50 pixels at the bottom of the file, and every element coming in this element is transfered to a second page (which we don't want, we only want one page).

The options are

const option = { filename: titredoc, margin: 0, image: { type: 'jpeg', quality: 7 }, pagebreak: { mode: 'avoid-all' }, html2canvas: { type: 'view', dpi: 300, scale: 7, quality: 3, letterRendering: true, useCORS: true }, jsPDF: { unit: 'px', format: [1701, 1180], orientation: 'p' } };

For the landscape mode, and

const option = { filename: titredoc, margin: 0, image: { type: 'jpeg', quality: 1 }, pagebreak: { mode: 'avoid-all' }, html2canvas: { dpi: 300, scale: 4, letterRendering: true, useCORS: true }, jsPDF: { unit: 'px', format: [1170, 1750], orientation: 'l' } };

For the portrait mode. As you can see, not a lot changed, but the problem is present.

DO you have a solution for this issue ?

thm-meder commented 1 month ago

Hey, it's been a week. Nobody have seen this issue ?

thm-meder commented 4 weeks ago

Is this library unsupported ?

thm-meder commented 2 weeks ago

Two weeks later and still nothing ?