Quería crear un documento PDF a partir de la cadena HTML que obtengo de SQL usando jsPDF .
//Cadena HTML (parte de)
<table style='width:100%'> <table class="test_listview" width="100%"><tr><td width="1%"></td><td width="20%";padding: 5px; style="line-height: 20px;"><b>SG:</b></td><td width="28%";padding: 5px; style="border-bottom: 1px solid #000;line-height: 20px;">Test</td></tr></table></table>//Intentó
var tag = document.createElement("p"); tag.textContent = //Pasted the above HTML; const input = tag; html2canvas(input) .then((canvas) => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF(); pdf.addImage(imgData, 'JPEG', 0, 0); pdf.save("download.pdf"); }); El compilador no funcionó. Entonces, ¿hay alguna forma de hacer que funcione usando jsPDf y htmlCanvas ? O alguna alternativa a esto??
Algo así como pasar esta cadena HTML y generar el PDF.