)
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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to save a PDF document by replacing the original PDF document in the server side of the PDF viewer control?

Platform: ASP.NET Web Forms |
Control: PdfViewer |
Published Date: June 7, 2018 |
Last Revised Date: June 20, 2019

You can save the copy of the PDF document to the location in the local disk (where the original document is presented) by modifying the Download () action method in the server-side (web API controller) as a workaround. Refer to the following code snippet to save the PDF document in the server-side. 

Code snippet

PdfViewerHelper helper = new PdfViewerHelper(); 
//Get the base64 string of the PDF document 
object json = helper.GetDocumentData(jsonResult); 
string base64String = json.GetType().GetProperty("documentStream").GetValue(json,null).ToString(); 
if (base64String != null || base64String != string.Empty) 
{ 
//Get the byte array from the base64 string of the PDF document 
   byte [] byteArray = Convert.FromBase64String(base64String); 
//Save the PDF document in the desired location in the disk 
System.IO.File.WriteAllBytes(HttpContext.Current.Server.MapPath("~/Data/F# Succinctly.pdf"), byteArray); 
} 
return null; 
 

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewerWeb344122673

2X faster development

The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon