We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to download a PDF using AJAX Call

Syncfusion Essential PDF is a .NET PDF library used to create, read, and edit PDF documents. Using this library, you can download PDF documents using AJAX Call.

A file cannot be downloaded with AJAX directly. You can request a file using AJAX, but AJAX response will contain the actual file stream. Due to JavaScript limitations, you cannot save the stream on the user’s machine with a file download dialog. As a work around, you can check the status of the PDF generation and then export the document after saving in the disk using AJAX call.

Steps to download PDF using AJAX call programmatically:

  1. Create a new ASP.NET MVC application project.

Create a ASP.NET MVC application project

  1. Install the Syncfusion.Pdf.AspNet.Mvc NuGet package as a reference to your .NET Framework application from NuGet.org.

NuGet package reference

  1. A default controller with name HomeController.cs gets added on creation of ASP.NET MVC project. Include the following namespaces in that HomeController.cs file.

 

 

  1. Add a following code in the index.cshtml.

 

  1. Add a new action method named GeneratePDF in HomeController.cs and include the following code snippet to download PDF using AJAX call.

 

 

A complete working sample can be downloaded from AjaxCall.zip.

By executing the program, you will get the PDF document as follows.

Output document screenshot

Refer here to explore the rich set of Syncfusion Essential PDF features.

Note:

Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.

 

 

 

 

Article ID: Published Date: Last Revised Date: Platform: Control:
4975 05/23/2015 11/14/2018 WinForms PDF
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon