Export and save file with Web API

1 posts, 0 answers
  1. Telerik Admin
    Telerik Admin avatar
    1690 posts
    Member since:
    Oct 2004

    Posted 04 Dec 2015 Link to this post


    Telerik Product and Version 

    UI for ASP.NET AJAX 2015 Q3

    Supported Browsers and Platforms

    Components/Widgets used (JS frameworks, etc.)

    .NET 3.5/4.0/4.5  C#


    This sample demonstrates how you can use the ClientExportManager to export content to .PDF and save the file to a specified folder with Web API using an ExportController. The sample contains two pages, the first one (ExportOrgChart.aspx) shows only export of a div containing a RadOrgChart, without saving the file to a specific folder. The second page (ExportSaveOrgChart.aspx) exports and saves the .PDF file to the "files" folder. This is made possible with the ExportController's SaveFile() method. First the data is encoded in the onClientPdfExporting handler and sent to the server with an AJAX request. The SaveFile() method then processes it and saves the file to the "files" folder appending a GUID to the filename. The routing is configured in the Global.asax file.

Back to Top