Pdfkit displaying and download pdf

So I got this working but not in an ideal way. It seems you can’t set the src of an iframe in wix to a blob URL

<html>
  <head>
  <script src="https://github.com/foliojs/pdfkit/releases/download/v0.11.0/pdfkit.standalone.js"></script>
  <script src="https://github.com/devongovett/blob-stream/releases/download/v0.1.3/blob-stream.js"></script>
    
    <script type="text/javascript">
    window.onmessage = (event) => {
        if (event.data) {
            // create a document and pipe to a blob
            var doc = new PDFDocument();
            var stream = doc.pipe(blobStream());
            doc.font('Helvetica');
              doc.fontSize(20);
              doc.text('Some Text',200,20);              

              // end and display the document in the iframe to the right
              doc.end();
            stream.on('finish', function() {
                const blob = stream.toBlob('application/pdf')
                const a = document.createElement('a');
                a.href = window.URL.createObjectURL(blob);
                a.download = "YourFileName";
                a.style.position = 'fixed';
                a.target = '_blank';
                document.body.appendChild(a);
                a.click();
                document.body.removeChild(a);
            });
      };
    };
    </script>
  </head>  
  <body>
  </body>
</html>

and then my page code is just to trigger the event so the download doesn’t happen automatically.

export function button1_click(event) {
$w(‘#html1’).postMessage(“blank”)
}

I removed all the extra stuff I am doing and just added a very simple bit of text into the pdf. But it works now without the display of the pdf which I could handle by using my old method except for the fact that I think people would expect to download from that iframe and it won’t work. So it would be nice if the src of the iframe could be set in wix so this works