Closed axetroy closed 1 year ago
This function runs the generate_file or "generatePDF" function on JS side with created bytes. It's easier to customize this way.
@jussiniinikoski Thanks for your response. and I finally found it.
let generatePDF = (data) => {
const blob = new Blob([data], {
type: 'application/pdf'
});
if (pdfFileBlobURL !== null) {
URL.revokeObjectURL(pdfFileBlobURL);
}
pdfFileBlobURL = URL.createObjectURL(blob);
// for debugging purposes, open another window
//window.open(pdfFileBlobURL, "_blank");
window.location.href = pdfFileBlobURL;
}
To be honest, it's not obvious that such an interface.
I am going to transform it and return bytes or Blob/File directly
https://github.com/jussiniinikoski/wasm-pdf/blob/467eef02a67250c61956d94c58dc2419cfe19ecc/src/lib.rs#L18C5-L29
The run function return nothing, and How could I get the PDF binary or URL?