add style to div generated by html2pdf.js

Viewed 586

html2pdf.js is a package for generating pdf's from html it is based on jspdf and html2canvas. It has a nice feature where it can insert page-breaks in order not to split elements. The way it works is that it loops over all the elements and creates empty div's where a page break needs to be inserted. I would like to style those divs and instead of having blank white space would like to be able to insert a class to determine how they would look. The issue is I don't seem to have access to this new HTML that will be converted to a pdf. The API seems to indicate that this is possible here but when I put in code like this:

var worker = html2pdf();
                worker.set(opt).from(finalHtml).toContainer().toCanvas().then(newHtml => {
                    console.log(newHtml)
                    return newHtml
                })

I am getting undefined. This is true whether I chain to toCanvas() and toContainer or not. Basically I would like the html generated here, how do I access this?

0 Answers
Related