pdfviewer get file loaded in server side from asp button

how is it possible to download the file loaded in the pdfviewver control in the code behind from an asp button?
Thanks

5 Replies 1 reply marked as answer

AA Akshaya Arivoli Syncfusion Team November 26, 2020 02:56 PM UTC

Hi Giovanni, 

Thank you for contacting Syncfusion support. 

We can download the PDF documents from the code behind using the download() API available in PDF Viewer. Refer to the following code snippet 
 <button onclick="download();">Download</button> 
 
<script> 
  function download(){ 
  var pdfviewer = document.getElementById('PdfViewer').ej2_instances[0];   
  pdfviewer.download(); 
 
  } 
  </script> 
 


Kindly try it and revert us with more details about your requirement if you still have concerns about it.  
Regards,  
Akshaya   



GI Giovanni November 26, 2020 06:32 PM UTC

thanks but I would need to know how to do it with ej1 no ej2

ej2 i can't install it gives me the following error

Error Unable to add reference to "pdfium".
Verify that the file is accessible and that the COM component or assembly is valid.

Thanks


AA Akshaya Arivoli Syncfusion Team November 27, 2020 01:15 PM UTC

Hi Giovanni,  
 
Thank you for your update. 
 
Please find the details from the below, 
 
Query 
Details  
thanks but I would need to know how to do it with ej1 no ej2 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
We can download the PDF documents from the code behind using EJ1 PDF Viewer. Refer to the following code 
 
<button onclick="download()" type="button">Donwload</button> 
 
  var pdfviewerObj = $("#ContentPlaceHolder1_PdfViewer1").data("ejPdfViewer"); 
                        pdfviewerObj.download(); 
 
We have created the sample for the same and shared in the below link, 
 
              ej2 i can't install it gives me the following error 
 
Error Unable to add reference to "pdfium".
Verify that the file is accessible and that the COM component or assembly is valid.
 
 
 
 
We have embedded the Pdfium rendering engine in our PDF Viewer for robust rendering, so pdfium dll will be generated on runtime within your project location and there is no need to include the pdfium dll in the project references.  
 
Refer to the below KB link to create pdfviewer web service project in ASP.NET Core  
 
 
 
Kindly try it and revert us with more details if you need further assistance. 
 
Regards, 
Akshaya 


Marked as answer

GI Giovanni November 27, 2020 10:34 PM UTC

Thanks it works perfectly.
Just one last thing I can use PdfViewerHelper to get the base64 of the pdf in javascript and not in the code-behind.
I'm looking for a solution to save my pdf file to disk after modifying the fill forms, and know when this happened correctly, to notify the user of the save.
it's possible?


AA Akshaya Arivoli Syncfusion Team November 30, 2020 12:45 PM UTC

Hi Giovanni, 

Thank you for your update. 

We can save the PDF documents in the database by modifying the Download() web action method. Refer to the below KB, similarly, you can get the document bytes and then save the save in the database as per your requirement. 


Also, our PDF Viewer supports downloadStart and downloadEnd event, using that we can track the status of the download action, 


Kindly try it and revert us with more details about your requirement and the modified sample, if you still have concerns about it.   

Regards, 
Akshaya 


Loader.
Up arrow icon