I am having problems when I try to use the lib jsPDF in order to generate dynamic PDF documents and download them from the browser. The problem is 'Unsupported mime type
'. This is due to the function getBlob() that generates an instance new Blob() with the type = 'application/pdf' into options parameter. I was using this lib last Friday all day and it was working fine. But today Monday's morning is not working anymore. This could be due to the WInter 19 release switch? Or maybe Salesforce is restricting the mime types supported into the lightning community. I have ensured that the File upload and download security for PDF is Hybrid. Thanks a lot!
The code is the following:
var doc = new jsPDF('p', 'pt');
console.log(doc);
var data = doc.output();
console.log('### output: ', data);
var buffer = new ArrayBuffer(data.length);
var array = new Uint8Array(buffer);
console.log('### buffer: ', buffer);
for (var i = 0; i < data.length; i++) {
array[i] = data.charCodeAt(i);
}
console.log('### array: ', array);
var blob = new Blob(
[array],
{type: 'application/pdf'}
);
console.log('### blob: ', blob);
saveAs(blob,'test.pdf');