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. Image for the cookie policy date

Solution to view pdf file loaded from server based on arguments

I have an Angular application which has the ASP.NET MVC as the server controller. I have simple requirement to view the pdf file on the browser. The use case is UI sends the fileId to the MVC controller which in turn interpretes the location of the file from the database. 
I have gone through the documentation of the PdfViewer but I couldnt find an easy working solution where in I can pass the params and pdfviewer loads the file from the server's response stream. 
So, I need your help and looking forward to find a solution with the help of your team. Thanks! and Im using Syncfusion 14.4

5 Replies

SA Sabari Anand Senthamarai Kannan Syncfusion Team May 22, 2017 12:18 PM UTC

Hi SaravanaRaj, 
  
Thank you for using Syncfusion products. 
  
We have created a sample for loading the PDF document from the database in a Angular application with ASP.NET MVC controller. You can download the sample from the following link. 
  
  
In the above sample, a text box is provided to enter the document id (which you have provided in the Database). On clicking the button "Load the Document", the location of the PDF document from the database will be sent as response from the MVC controller and the PDF document will be loaded in the PDF viewer control. 
  
Note: Please modify the sample based on the database that you have created. The database table has two columns "DocumentID" for id of the document and "Data" for full path of the PDF document. 
  
Please confirm us that the provided sample meets your requirements. If not, please let us know further details about your requirements. These details will be helpful for us to analyze further and assist you better. 
  
Regards, 
Sabari Anand 



SS SaravanaRaj Sundararaj May 22, 2017 06:37 PM UTC

Thanks for the sample. It solves our problem but not completely. Do I have to load a default pdf document on the initial load? Because, in our page, the initial view is blank and when user click on a node (which is on the left navigation bar), it loads the pdf doc inside the viewer.Also do I have to define the PostViewerAction in the controller class? A load call is triggered in the JS when this $("#pdfviewer").ejPdfViewer({ serviceUrl: "/PDFDemo" }); is initialized. But a call to this nethod pdfviewer.load(data) aborts the previous load request which in turn triggers postViewerAction method to be called (in the error handling function).Im still troubleshooting but if this issue rings a bell, please let us know the solution. Thanks!


SA Sabari Anand Senthamarai Kannan Syncfusion Team May 23, 2017 10:06 AM UTC

Hi SaravanaRaj, 
  
Thank you for your update. 
  
Please find the details for your queries in the below table. 
  
Query 
Details 
Do I have to load a default pdf document on the initial load? Because, in our page, the initial view is blank and when user click on a node (which is on the left navigation bar), it loads the pdf doc inside the viewer. 
We need to provide the default PDF document to the PDF viewer control in the version 14.4 during control initialization. But we have provided the support to initialize the PDF viewer control without providing the default PDF document in our latest version (i.e.15.2.0.40) of Essential Studio, the PDF viewer control renders blank when we have not provided default PDF document in the MVC controller. 
  
We have modified the previously provided sample to version 15.2.0.40 and the PDF viewer will render blank initially(the default PDF document is not provided) in the sample. You can download the sample from the following link. 
  
Also do I have to define the PostViewerAction in the controller class? A load call is triggered in the JS when this $("#pdfviewer").ejPdfViewer({ serviceUrl: "/PDFDemo" }); is initialized. But a call to this nethod pdfviewer.load(data) aborts the previous load request which in turn triggers postViewerAction method to be called (in the error handling function). 
We have modified the Web API controller API’s from the product version 15.1.0.33 of Essential Studio and removed the AJAX call from the error handling function of the previous AJAX request in the PDF viewer control from the same version. Please upgrade to our latest version (i.e. 15.2.0.40) of Essential Studio to resolve this issue. You can download the latest Essential Studio setup from the following link. 
  
  
Please let us know if you need any further assistance. 
  
Regards, 
Sabari Anand 



SS SaravanaRaj Sundararaj May 23, 2017 09:21 PM UTC

Thanks for the response. I will try out the latest version.


PG Pon Geetha A J Syncfusion Team May 24, 2017 04:54 AM UTC

Hi Saravanaraj, 
  
Please try our latest version and let us know if you need any assistance, we will be happy to assist you. 
  
Regards, 
Geetha 


Loader.
Live Chat Icon For mobile
Up arrow icon