target: #feature
. #feature
is you CSS selector, like in the previous example. Now, when the page is loaded an image screenshot will now be created in the same location as the script tag, which will contain all of the contents of the features div and nothing else.npm install pdfmake
and saving the Gist in htmlToPdf.js
I use it like this:pdfMake
's getBuffer()
function), all from the browser. The generated pdf turns out to be nicer for this kind of html than with other solutions I have tried.jsPDF.fromHTML()
suggested in the accepted answer, as that solution gets easily confused by special characters in my HTML that apparently are interpreted as a sort of markup and totally mess up the resulting PDF.jsPDF.from_html()
function, not to be confused with the one from the accepted answer) is not an option for me since I want the text in the generated PDF to be pasteable, whereas canvas based solutions generate bitmap based PDFs.