Add Comment. Disclaimer : The code samples and API available at www. You are free to use it for commercial as well as non-commercial use at your own risk, but you cannot use it for posting on blogs or other tutorial websites similar to www.
All the code samples and API provided by the authors are solely their creation and neither the author nor the site are responsible if it does not work as intended. I agree to the above terms. Download Required. What our readers say. Error Details. This site makes use of Cookies.
Concerning the answer given by Mayur Padshala this is the correct logic to download a pdf file via ajax but as others report in the comments this solution is indeed downloads a blank pdf. The reason for this is explained in the accepted answer of this question : jQuery has some issues loading binary data using AJAX requests, as it does not yet implement some HTML5 XHR v2 capabilities, see this enhancement request and this discussion.
Hope this will save you a few hours and spare you from a headache. Solution was this:. Include download. If you have to work with file-stream so no physically saved PDF like we do and you want to download the PDF without page-reload, the following function works for us:. Question I have an action class that generates a PDF. The contentType is set appropriately. URL window. It is reusable. Hope that helps. You will be notified via email when the author replies to your comment.
Please select a comment to reply. You can add your comment about this article using the form below. Make sure you provide a valid email address else you won't be notified when the author replies to your comment Please note that all comments are moderated and will be deleted if they are Not relavant to the article Spam Advertising campaigns or links to other sites Abusive content.
Please do not post code, scripts or snippets. Required Invalid Email Address. Security code:. Required Invalid security code. Vpant Vpant 2 2 silver badges 12 12 bronze badges. It can pdf file path xhr. MemZ MemZ 97 1 1 silver badge 5 5 bronze badges. Ninja Ninja 1, 1 1 gold badge 20 20 silver badges 27 27 bronze badges. Solution was this: Include download.
Jurijs Kastanovs Jurijs Kastanovs 1 1 gold badge 15 15 silver badges 33 33 bronze badges. I spent several hours on the same problem. PDF font won't be loaded correctly. Thank you! JMax 25k 12 12 gold badges 65 65 silver badges 87 87 bronze badges. This solution worked like a charm. I'm calling a server side script which makes a curl call to a service which fetches the file via curl. This works great as I can drop a loading gif and disable the request link.
Please write some explanation for your answer. Nathan Tuggy 2, 27 27 gold badges 29 29 silver badges 36 36 bronze badges. Do you have to do it with Ajax? Coouldn't it be a possibility to load it in an iframe?
I am checking if, this could be done with Ajax. If it is technically impossible or an inferior approach, i'd switch to other approaches. Userino Userino 7 7 silver badges 31 31 bronze badges. Sign up or log in Sign up using Google.
Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Who owns this outage? Building intelligent escalation chains for modern SRE.
Podcast Who is building clouds for the independent developer? Featured on Meta. Now live: A fully responsive profile. Reducing the weight of our footer.
0コメント