Answer the question
In order to leave comments, you need to log in
How to add multiple images to a pdf using jspdf so that each image is on a separate page?
Below are snippets from the vue component:
loading the pdf for instant viewing
...
<object id="pdf_viewer" type="application/pdf" :data="[pdf ? pdf : empty()]" width="100%" height="100%"></object>
...
generatePDF(canvas) {
const pdf = new jsPDF('p', 'pt', 'a4')
canvas.forEach((image, i) => {
!!i && pdf.addPage()
pdf.addImage(image, 'PNG', 80, 80, image.width, image.height, `image${i}`)
})
// pdf.output('save', 'tasks.pdf');
this.pdf = pdf.output('datauristring'); // здесь походу что-то не то происходит
},
empty() {
const pdf = new jsPDF();
return pdf.output('datauristring');
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question