I have a PhantomJS script that generates PDF from HTML, the HTML content has some structure separated by "lines" of content (lines, like in Bootstrap), I added a "page break: avoid" this "line" of content, so the content is not cut in the middle two pages.
What I want to do now is fill the background of the last page, because the content is dynamic, the last background of the page does not fill the entire PDF page. I did some calculations to make the html body bigger than the rendering based on the height of the body, but I understand that PhantomJS returns the height based on the viewport size, not the PDF size.
Is there anyway to know the height of the PDF body or any work to always fill the last background of the page or in the worst case scenario to tell phantom to use the background color for all pages?
source
share