Fix Adobe PDF Embed API addEventListener Error in ASP.NET
Question details
The user is encountering a JavaScript error stating that the object does not support the addEventListener property or method while implementing the Adobe PDF Embed API in an ASP.NET Web Forms application.

- Product
- Adobe PDF Embed API
- Device & OS
- not provided
- Scenario
- Integrating the Adobe PDF Embed API to display a PDF document within an ASP.NET Web Forms page.
- Observed behavior
- The ASP.NET application throws an 'Object does not support property or method addEventListener' error and fails to render the embedded PDF.
Verify which web browser you are currently using to test your ASP.NET Web Forms application, as older legacy browsers handle JavaScript events differently than modern browsers.
Test Your Application in a Modern Web Browser
The simplest fix is to run your ASP.NET application in a modern browser that fully supports standard JavaScript event listeners required by the Adobe PDF Embed API.
The addEventListener method is a standard feature in all modern web browsers. However, older browsers like Internet Explorer use a proprietary method instead. If Visual Studio is defaulting to an older browser for debugging, the API will fail to load.
Launch Visual Studio and open your current ASP.NET Web Forms project where the Adobe PDF Embed API is implemented.
Look at the standard toolbar at the top of Visual Studio, specifically the dropdown menu next to the green 'Run' or 'IIS Express' debugging button.
Click the dropdown arrow and select a modern browser such as Google Chrome, Microsoft Edge, or Mozilla Firefox instead of Internet Explorer.
Click the run button to launch your application in the selected modern browser and verify that the PDF loads without the addEventListener error.

Implement Cross-Browser JavaScript Fallbacks
If your application must support legacy browsers like Internet Explorer, modify your JavaScript initialization code to handle both event attachment methods.
View and Manage PDFs Locally with WPS Office
While browser compatibility can complicate web-based PDF API implementations, handling your PDFs locally is seamless with WPS Office. It provides a highly compatible, lightweight alternative for viewing, editing, and annotating PDFs alongside comprehensive document processing.
- 1. Download the installer: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install the software: Run the downloaded executable file and follow the simple on-screen instructions to install the suite.
- 3. Open your PDF directly: Right-click any PDF file on your computer, select 'Open with', and choose WPS Office for instant, error-free viewing.

Frequently Asked Questions
Why does the addEventListener error only appear in Internet Explorer?
Older versions of Internet Explorer (specifically IE8 and below) do not support the standard addEventListener JavaScript method. Instead, they rely on a proprietary method called attachEvent. If a script exclusively calls addEventListener, these older browsers cannot process it and will throw an error.
Can I embed a PDF without using JavaScript APIs?
Yes, you can use standard HTML elements like the embed or iframe tags to display PDFs directly in a browser. While this avoids JavaScript compatibility errors, it offers less developmental control and fewer features compared to dedicated tools like the Adobe PDF Embed API.
Is the Adobe PDF Embed API compatible with ASP.NET Core?
Yes. The Adobe PDF Embed API is a client-side JavaScript solution. It works entirely in the user's browser, meaning it functions independently of your server-side framework. It is fully compatible with both ASP.NET Web Forms and ASP.NET Core, provided the client accesses it via a modern web browser.




