I'm willing to invite all my friends to my wedding, I have all the addresses in an Excel and I made a postcard in html using jQuery and urlParams to make every postcard personal.
Now I am stuck at the point where I want to turn all the pages into PDFs to print them (I'd like to have one big PDF with page 1 guy1 front, page 2 guy1 back, page 3 guy2 front and so on...)
I've tried with jspdf like this:
var doc = new jsPDF('landscape','pt');
doc.fromHTML(documtent.body,100,100,{});
doc.save('bigpdf');
but it gets my html all messed up and it doesn't look like on browser (and it has no background)
I've also tried html2canvas:
html2canvas(document.body).then(canvas => {
saveAs(canvas, 'bigpdf');
});
function saveAs(uri, filename) {
var link = document.createElement('a');
if (typeof link.download === 'string') {
link.href = uri;
link.download = filename;
//Firefox requires the link to be in the body
document.body.appendChild(link);
//simulate click
link.click();
//remove the link when done
document.body.removeChild(link);
} else {
window.open(uri);
}
}
but the downloaded file has no <p>
tag on it nor QR code (I made a qr code to track who is coming)
I hope you'll find my solution
Many thanks in advance