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
close icon

data('ejpdfviewer') doesn't exist

Hi,

I use PdfViewer for ASP.Net Web Forms to display pdf and your select to change pdf wich is displayed. To make it, I used your documentation here : https://asp.syncfusion.com/demos/web/pdfviewer/default.aspx

But when I change the pdf with this select I have an error in the console : Uncaught TypeError: Cannot read property 'load' of undefined.

It don't find 'ejpdfviewer', I don't know why.

I use this function : 
function onChange(args) {
            var _filename = args.value;
            var _ejPdfViewer = $(#MainContent_PdfViewer2").data("ejPdfViewer");
            _ejPdfViewer.load(_filename);
        }



4 Replies

AA Akshaya Arivoli Syncfusion Team October 24, 2019 09:39 AM UTC

Hi Judicael, 

Thank you for contacting suycfusion support.  

Based on the provided details we suspect that PDF Viewer instance is not obtained properly, so the error is thrown. Can you please ensure the below things, 

  1. In the provided code we can see that the code to get the PDF Viewer instance is not provided properly. Please find the modified code,
function onChange(args) { 
            var _filename = args.value; 
            var _ejPdfViewer =$(“#MainContent_PdfViewer2").data("ejPdfViewer"); 
            _ejPdfViewer.load(_filename); 
        } 

  1. Ensure to provide the correct PDF Viewer’s Div ID to get its instance
  2. Ensure the PDF Viewer instance is obtained.
  3. Ensure whether the PDF Viewer is initialized, before calling the load() API.
  4. Ensure to refer all the necessary Scripts and CSS in your project as provided in this link.
  5. Ensure to refer the Scripts, CSS and packages of same version in your project.
 
We have also created the sample for the same and shared in the below link, 


Please try this and revert us with more details, Essential Studio version, error details and modified sample if you still have concerns. These details will be helpful for us to investigate further on this and update you. 

Regards,  
Akshaya  



JU JudicaelG October 24, 2019 11:05 AM UTC

Hi,

it's just an typing error in my topic, sorry...

I use Syncfusion.ASP.Net V17.3.0.19, Syncfusion.EJ.pdfviewer V17.3.0.19.

I relooked all your point and I look the sample project and I have same things you have but I always this error in the console of my navigator : Uncaught TypeError: Cannot read property 'load' of undefined.

When I do console.log($("#MainContent_PdfViewer2").data()) to look if I find 'ejpdfviewer', there is nothing.... 

I attach my differents files




Attachment: pdfviewer_604b8e7d.zip


JU JudicaelG October 24, 2019 12:55 PM UTC

hum.... Ok I did it, it works :)

I put the Jquery script in Site.master and the rest of scripts in my page with pdfviewer. 

thanks for your helps


AA Akshaya Arivoli Syncfusion Team October 25, 2019 05:20 AM UTC

Hi Judicael, 

Thank you for your update. We are glad to hear that the issue is resolved.  

Regards, 
Akshaya 


Loader.
Live Chat Icon For mobile
Up arrow icon