I am trying to create a button that will start the automatic loading of a pdf page of a page, what it looks like with sassing. However, all I try is that the style is messed up.
Here is the page (this is a testing site with several different types of content)

But the pdf looks like this:

I pull out jspdf.debug.jsand have the following HTML + script button on my page:
<div id="bypass">
<button id="pdf-new" style="margin: 50px;"><a href="javascript:demoFromHTML()" class="button" style="color: black;">Generate PDF</a></button>
</div>
<script>
function demoFromHTML() {
var pdf = new jsPDF('p', 'pt', 'letter');
source = $('#content')[0];
specialElementHandlers = {
'#bypass': function (element, renderer) {
return true
}
};
margins = {
top: 80,
bottom: 60,
left: 40,
width: 522
};
pdf.fromHTML(
source,
margins.left,
margins.top, {
'width': margins.width,
'elementHandlers': specialElementHandlers
},
function (dispose) {
pdf.save('Test.pdf');
}, margins);
}
</script>
How can I make styling immutable from html to pdf?
source
share