Articles in this section
Category / Section

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

1 min read

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: https://www.syncfusion.com/downloads/support/directtrac/general/ze/PdfViewerWeb344122673

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied