![]() ![]() Here, once again what you want to do (set an anchor to point to your Blob's data) can be done with the Blob directly: simply create a blobURI (which is just a pointer to the data in memory) by calling URL.createObjectURL(blob). *The remaining 1% being when you need to create standalone documents that will include binary data, it happens but not that often. I can't tell for sure why your code doesn't work, but I can tell for sure that what you are doing is useless at best.ĭo not convert a Blob to a dataURI, 99%* of the time, what you want to do with this dataURI can be done directly with the original Blob and a blobURI. You can use the same method and decode the content of the octet-stream before creating the blob. Link.download = "FileName" + new Date() + ".pdf" ![]() Here is the solution: function download(pdfUrl) ) Ĭonst fileURL = URL.createObjectURL(file) Ĭonst link = document.createElement('a') When linking another Pen as a resource, make sure you use a URL Extension of the type of code you want to link to. So, if you check the response, you will get characters like these %PDF-1.4 I tried using Fetch API to download the PDF file from server which is giving octet-stream content as response.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |