Im trying to download a PDF file from binary string, which I receive as a response from an Ajax.
I receive the following data (binaryString):
%PDF-1.4....
.....
....content of file
....
%% EOF
I tried this:
var blob=new Blob([binaryString], {type: "application/pdf"});// change resultByte to bytes
var link=document.createElement('a');
link.href=window.URL.createObjectURL(blob);
link.download="myFileName.pdf";
link.click();
And also tried using the download.js library:
download(binaryString, "file.pdf", "application/pdf");
However, both return a PDF with the correct number of pages, but completely blank.