Go to main content

help desk

I try to generate a PDF using html2pdf but it wont work?

I'm using html2pdf to generate the invoice in my programm. Some invoice have more that one page. BUt right now it is working sometimes and other it is not working.

Asked on 2023-11-03 10:28:00

OFFICIAL ANSWER

Looking at the code we fount that you are using a CSS attribute to avoid the section of been broken on many pages. 
The issue here is that in this section if the content is taller than a letter page it will crash in the generation by not been able to keep the content together. 

We remove this style="page-break-inside: avoid;" CSS and then the generation work perfectly.

 

Avoid using the below attribute if you it is on a section where the height is variable based on the content : 

style="page-break-inside: avoid;"

 

Answer by:
Etienne Carrier

Replied on: 2023-11-03 11:37:00