¿Alguien puede ayudarme con un fragmento de código que genera dos DIV HTML en un archivo PDF?
Probé este código y pdf.save() es la única función que funciona, pero pdf.output() no funciona, así que necesito otro fragmento
const pdf = new jsPDF('p', 'mm', 'a4'); const imgWidth = 208; const position = 0; let page1 = document.querySelector('#report-one'); let page2 = document.querySelector('#report-two'); const [imgPage1, imgPage2] = await Promise.all([html2canvas(page1), html2canvas(page2)]); // Process first image let imgHeight = imgPage1.height * imgWidth / imgPage1.width; let contentDataURL = imgPage1.toDataURL('image/jpeg'); pdf.addImage(contentDataURL, 'PNG', 0, position, imgWidth, imgHeight); pdf.addPage(); // Process second image imgHeight = imgPage2.height * imgWidth / imgPage2.width; contentDataURL = imgPage2.toDataURL('image/jpeg'); pdf.addImage(contentDataURL, 'PNG', 0, position, imgWidth, imgHeight); pdf.save('Result.pdf');