'html2pdf cuts content in half when html is converted to PDF - javascript

I am trying to achieve webpage to PDF conversion using html2pdf library in javascript but content is cut in half when documents are longer than 1 page and elements like e.g. images happen to be between pages. How can I get them to the other page if they don't fully fit within the previous PDF page?



Solution 1:[1]

Nevermind, I fixed the issue. (If anyone wants to know how, the comments saying "exceptions 1-30" and "irqs 1-14" need to be replaced with actual code, I just had a brain freeze lol)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 LevandarHeight