Load pdf file from asp.net core web api & save

I need to load pdf files from my server with asp.net core web api & save back file again to server after annotation.
I also need to attach user info on stamps in annotation.

Please help.

1 Reply 1 reply marked as answer

AA Akshaya Arivoli Syncfusion Team August 14, 2020 11:59 AM UTC

Hi Lalit, 

Thank you for contacting Syncfusion support. 

Query 
Details  
I need to load pdf files from my server with asp.net core web api & save back file again to server after annotation. 
We can save the PDF document in the server in the server side by modifying the Download() action method using the serverActionSettings API available in PDF Viewer. We have created sample and shared in the below link,  



Note: Kindly run the web service project and provide that URL to serviceUrl . Click on the ‘Download Document’ in the sample to save the document   

Code Snippet:  
   [HttpPost]  
        [Microsoft.AspNetCore.Cors.EnableCors("MyPolicy")]  
        //Post action for saving the PDF documents in Database  
        public IActionResult SaveinDB([FromBody] Dictionary<string, string> jsonObject)  
        {  
            PdfRenderer pdfviewer = new PdfRenderer(_cache);  
            string documentBase = pdfviewer.GetDocumentAsBase64(jsonObject);  
            string base64String = documentBase.Split(new string[] { "data:application/pdf;base64," }, StringSplitOptions.None)[1];  
            //please insert your code snippet to uplaod the document in DB  
            return Content(String.Empty);  
  
        }  
 
    

I also need to attach user info on stamps in annotation. 

Our PDF Viewer supports custom stamps using that you can add the jpg image as per your requirement. 

We can also the custom stamps from code behind using the customStampSettings, 



viewer.customStampSettings = { customStamps: [{ customStampImageSource: "", customStampName: "image" }], isAddToMenu: true };  




Please revert us with more details about your requirement and the use case if you need further assistance.  

Regards, 
Akshaya 



Marked as answer
Loader.
Up arrow icon