Is there any way to create a file (eg: a Pdf) in Javascript by setting its mime type,title, content, etc and display it in the browser with the option to download?
I have a Base64 bytestream of a pdf in the javascript and I am using it to display the pdf to the user by:
document.location.href = 'data:application/pdf;base64,' +data;
which opens the file in a new window (it works in all browsers except IE as it has url restrictions) and the file is not downloadable in all browsers. IE is the primary browser for
testing my application so this is a big issue.
Option of using a backend technology like
Java to create a file and send it as the response is ruled out as I have an ABAP backend and it can give me only the bytestream. Many suggested using jsPdf but jsPdf creates the content from javascript (like setting line by line info and formatting) and uses it. But as I already have all the data and formatting I need I am not able to use it.
Here is the question I asked for byte conversion and display of pdf in the webpage in stackoverflow, that got answered, for additional info:
http://stackoverflow.com/questions/11131789/how-to-convert-hexadecimal-byte-stream-in-the-form-of-string-to-actual-bytestrea
I have done my best in searching for the solution but couldn't able to find one yet. Please help. I will be thankful.
Regards, Riswan