Search code examples
javascriptjspdf

jsPDF returning blank page


The variable finalPestsTable is a html table with perfect syntax (have tested that). When the code runs a new tap opens with a completely blank output.

let finalPestsTable = `
        <table class="table" id="pdf_pests_table">
          <tr>${pestTableHeadings}</tr>
          ${pestTableBody}
        </table>
      `;

      let pdf = new jsPDF({
        orientation: 'p',
        format: 'a4'
      });
      pdf.fromHTML({
        source: finalPestsTable
      });
      pdf.output('dataurlnewwindow');

Solution

  • I had the same issue before, the work around is by doing this:

    window.open(doc.output("bloburl"), "_blank");