The output says that PDF is corrupted or Failed to load PDF. How to fix this?
Is there something wrong with the blob? I checked the blob and it returns blob:null/alphanumeric
function ExportPDF(elem, filename='') {
    var blob = new Blob([html], { type: 'application/pdf' } );
  
    // Specify link url
    var url = URL.createObjectURL(blob);
    // // Specify file name
    filename = filename ? filename + '.pdf' : 'document.pdf';
    // // Create download link element
    var downloadLink = document.createElement("a");
    document.body.appendChild(downloadLink);
    if (navigator.msSaveOrOpenBlob) {
        navigator.msSaveOrOpenBlob(blob, filename);
    } else {
        // Create a link to the file
        downloadLink.href = url;
        // Setting the file name
        downloadLink.download = filename;
        //triggering the function
        downloadLink.click();
    }
    document.body.removeChild(downloadLink);
}<div id="export"> 
  <text> 治験課題名 </text>
</div>
<button onclick="ExportPDF('export');">Export as PDF</button> 
    