How to save pdf file with ASP using JavaScript?
What I am trying to do is this: I have a PDF file and I instead the file will open in browser, I want a "saveas" dialog box to open and ask the user if he want to save the file.
I wrote this code in Java Script:
************************************************** ****
Response.Write("C:\ranimi.pdf");
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=ranimi23.pdf");
************************************************** ****
But, something is wrong. I do get a "SaveAs" dialogbog and it did save something, but I can't open my "ranimi23.pdf" file at all and the size is telling me the file is not being saved as I think it will.
What should I do in "Response.Write" in order to get the file in response...
Please advise.
|