JSPDF : how encode blob in jsPDF?

Viewed 378

I am using jsPDF() And I want to present a document, I have the value BASE64 And now I want to do a BLOB and return to normal view How can I do this with JSPDF?

That's the code,

const print = () => {
  const myFont = "";
  var doc = new jsPDF();
  doc.text(20, 20, "Name " );
  doc.addFileToVFS("MyFont.ttf", myFont);
  doc.addFont("MyFont.ttf", "MyFont", "normal");
  doc.output("dataurlnewwindow");
};

I do not know how to add the desired line

1 Answers
var blobPDF =  new Blob([ doc.output() ], { type : 'application/pdf'});
var blobUrl = URL.createObjectURL(blobPDF);  //<--- THE ERROR APPEARS HERE

window.open(blobUrl);  // will open a new tab

//window.open(blobUrl,'_system','location=yes'); will open a new window

This works for me.

Related