I am receiving from the server the following response:
Object {
$type: "base64",
$data: "JVBERi0xLjQK..."
}
I try to autodownload it with FileSaver.js
let arrayBuffer = atob(response.$data);
let blob = new Blob([arrayBuffer], {type: "application/pdf;charset=utf-8"});
saveAs(blob, 'myfile.pdf');
A PDF is generated, and downloads (it has the same page number as the original on the server), but is empty. However this works:
window.open("data:application/pdf;base64," + response.$data);
It opens the PDF with its content.