I am trying to convert blob object into base64
var out = doc.getZip().generate({
type: "blob",
mimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
}) //Output the document using Data-URI
In the below console. I am getting blob object.
console.log(Blob {size: 1402, type: 'application/vnd.openxmlformats-
officedocument.wordprocessingml.document'});
I used the blob object to convert into base64
var reader = new FileReader();
reader.readAsDataURL(out);
reader.onloadend = function() {
var base64data = reader.result;
console.log(base64data);
return;
}
but I am getting issue while converting into base64
Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'.
I used filesaver.js to allow me to download the file successfully by using saveAs() method
saveAs(out,"Details.docx");
console.log(Blob {size: 1402, type: 'application/vnd.openxmlformats- officedocument.wordprocessingml.document'});isn't valid javascript, so ... not sure how you can be getting a blob object logged to the consoleoutisn't the same thing when you pass it toreadAsDataURLthan when you logged it.