
Product
Introducing Reports: An Extensible Reporting Framework for Socket Data
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.
ngx-extended-pdf-viewer
Advanced tools
Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.
Welcome to ngx-extended-pdf-viewer – a powerful, full-featured PDF viewer for Angular applications. Whether you're building enterprise tools or internal utilities, this library gives you the control and customization options you need, all while preserving a native-like viewing experience.
Built on Mozilla’s pdf.js and extended with dozens of enhancements, it's ideal for serious applications that demand more than just basic PDF display.
⚠️ Version 26 requires Angular 19, 20, or 21. If you're using Angular 17 or 18, please continue using version 25.6.4.
Why this breaking change? There are many reasons: Version 26 supports zone-less Angular and migrates to signals. And Angular 18 exited its Long-Term Support (LTS) phase, and security vulnerability CVE-2025-66035 will not be fixed in Angular 17 or 18. Updating to Angular 19 ensures your application continues to receive critical security patches.
In general, I aim to support the last four Angular versions (roughly two years of updates), but sometimes security requirements force me to raise the minimum version sooner.
Is there a migration schematic? No - because migrating to ngx-extended-pdf-viewer shouldn't be a big deal. The library uses signals internally, but that hardly ever shows in your application, unless you're using @ViewChild to access properties of ngx-extended-pdf-viewer. Even then, solving the error messages should be easy. Adopting zone-less Angular was also surprisingly easy, at least in my showcase. I hope you'll experience a similarly smooth transition!
✅ Angular 21+ Zoneless Support
ngx-extended-pdf-viewer 26 now fully supports Angular 21+ zoneless change detection! The library works seamlessly in both zone.js and zoneless applications with zero configuration required.
Using Zoneless (Default in Angular 21+):
Simply use the library as normal - it will automatically detect zoneless mode and trigger change detection appropriately. You'll have to use cdr.markForCheck() every once in a while, but I assume you're already familiar with that pattern.
Using Zone.js (Optional):
If you prefer to use zone.js in your Angular 21+ application, add this to your app.config.ts:
import { provideZoneChangeDetection } from '@angular/core';
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
// ... other providers
],
};
Both modes are fully supported with the same API and features. See the changelog for details on the zoneless implementation.
Install via npm:
npm add ngx-extended-pdf-viewer
Peer dependencies:
| Package | Version |
|---|---|
@angular/core | >=19.0.0 <22.0.0 |
@angular/common | >=19.0.0 <22.0.0 |
In your component HTML:
<ngx-extended-pdf-viewer [src]="'assets/example.pdf'"></ngx-extended-pdf-viewer>
For NgModule-based applications:
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
@NgModule({
imports: [NgxExtendedPdfViewerModule],
})
export class AppModule {}
For standalone components (Angular 19+):
import { Component } from '@angular/core';
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
@Component({
selector: 'app-pdf-viewer',
standalone: true,
imports: [NgxExtendedPdfViewerModule],
template: `<ngx-extended-pdf-viewer [src]="'assets/example.pdf'"></ngx-extended-pdf-viewer>`,
})
export class PdfViewerComponent {}
Or configure in main.ts for application-wide availability:
import { bootstrapApplication } from '@angular/platform-browser';
import { importProvidersFrom } from '@angular/core';
import { NgxExtendedPdfViewerModule } from 'ngx-extended-pdf-viewer';
bootstrapApplication(AppComponent, {
providers: [
importProvidersFrom(NgxExtendedPdfViewerModule),
// other providers...
],
});
🧭 For hands-on examples and step-by-step guides, visit the showcase and the getting started page.
Version 20.0.2 fixes a critical security vulnerability (CVE-2024-4367). Update to this version or newer to stay safe from exploits via malicious PDF files.
Thanks to GitHub users ScratchPDX and Deepak Shakya for reporting the issue promptly.
Regarding security: I'm not perfect - it's always a best-effort approach without guarantees. I'm 100% committed, but I need your help, and even so, in the long run, errors are inevitable. The art is to close vulnerabilities before a hacker can exploit them - and that's a joint effort. Together, we'll manage. Don't hesitate to report bugs and vulnerabilities as soon as possible!
See the full list of features on the showcase site.
Breaking Change: Angular 19+ Required
Version 26 updates to Angular 19 to address security concerns (and to support both signals and zone-less Angular). Angular 18 exited its LTS phase, and CVE-2025-66035 will not be fixed in Angular 17 or 18.
Migration:
ng update @angular/core@19 @angular/cli@19This version migrates to signals, allows for zone-less Angular, and updates to pdf.js 5.4.530. The latter is a major internal refactoring. I assume it's not the last major refactoring, so brace yourself for more breaking changes. There's hope: the breaking changes are about the internal DOM structure of the viewer. As long as you don't manipulate that, you're safe. Otherwise, brace yourself for CSS changes. Version 26 is hit by such changes. In particular, the sidebar and the thumbnails are affected.
New features:
pdfDefaultOptions.enableComment = true; and [showCommentEditor]="true". The base project, pdf.js, didn't activate it yet, so please consider it a preview. Right now, it works, but it's possible Mozilla's going to implement breaking changes over the next few months.[readingDirection] input ('auto' | 'ltr' | 'rtl'). In RTL mode, spread pages display right-to-left, arrow key navigation is reversed, and horizontal/wrapped scroll modes display pages right-to-left.drawingStarted and drawingStopped annotation editor events fire when the user starts and stops actively drawing (ink/pencil) or highlighting.(linkAnnotationsAdded) event fires after auto-detected links are injected into the annotation layer.Stability improvements:
For a short time, the license had changed from Apache 2.0 to Apache 2.0 with Commons Clause, which allows free use, modification, and distribution while preventing commercial sale or paid services without permission.
But as it turned out, that license was more restrictive than I wanted it to be. So now the library is back to Apache 2.0.
[page] or [zoom] and the PDF viewer opens a PDF document for the second time, the PDF opens on the same page and with the same zoom setting it had before. Before version 25.5.0, the PDF would always open at page 1 and with zoom = pdfDefaultOptions.defaultZoomValue (which usually is 'auto'). I think that's a mildly breaking change, so I raised the version number to 25.5.0.#E8E8EB to #FFFFFF.pdfDefaultOptions.enableScripting - main toggle. Set it to true to allow execution of embedded JavaScript.pdfDefaultOptions.enableOpenActionJavaScript - allows JavaScript that runs when opening a PDF file. Requires pdfDefaultOptions.enableScripting = true.pdfDefaultOptions.enableCatalogAAJavaScript - allows JavaScript that runs when printing, saving, or closing a PDF file. Requires pdfDefaultOptions.enableScripting = true.Security note: Embedded JavaScript in PDFs runs inside a sandboxed JavaScript interpreter (written in C and transpiled to JavaScript) and does not use functions like eval(). These measures reduce - but do not eliminate - potential security risks. For that reason, all related options are disabled by default, and enabling them is at your own risk. While these features can be useful, be aware that no software can guarantee complete protection against malicious content. Read more about the JavaScript sandbox here.
Version 24.3.0 adds a dark mode. Thanks to Megan Truso for providing the pull request!
Version 24.2.0 and above:
enablePageReordering option allows users to reorder PDF pages by dragging thumbnails. Enable it with pdfDefaultOptions.enablePageReordering = true;.Version 24.1.0 and above: Improved accessibility by showing a hover effect when the mouse is over a button and by adding a blue ring to the active element, thus restoring the implementation we used to have a long time ago. Thanks to Megan for contributing this pull request!
Version 24.0.0:
pdf.js 5.3[(formData)]. In earlier versions, only the first field was changed. Kudos to Sebastien Fauvart for submitting this pull request!pdfDefaultOptions.enableSignatureEditor = true;. Caveat: these signatures are not cryptographic PDF signatures. They're merely "stamp annotations".❗ Version 23 includes a CSS bug where search highlights may render text invisible. To work around this, add the following to your global styles.css:
ngx-extended-pdf-viewer .textLayer .highlight.selected {
opacity: 0.25;
}
Remove this workaround after updating to 24.0.0+.
[inputs], events, and CSS hooks:
Use NgxExtendedPdfViewerService for:
If you're stuck on a feature, try cloning the showcase repository. It’s a clean and working example, and comparing it to your app often helps locate the issue. And if the showcase doesn’t work - you can blame me!
git clone https://github.com/stephanrauh/extended-pdf-viewer-showcase.git
cd extended-pdf-viewer-showcase
npm install
npm start
👉 Open a ticket here if something’s broken.
We want to hear from you!
👉 File issues here: GitHub Bug Tracker
If possible, include a code snippet or reproduction. Better yet - send a pull request!
I understand, but... realistically, I can’t maintain old versions in my spare time. The architecture allows for it, but I simply don’t have the bandwidth - unless something critical breaks.
If you're desperate for a fix or a new feature, there’s one option: ask my employer. I work as an IT consultant, and they may be willing to sponsor time to work on ngx-extended-pdf-viewer during business hours.
If this library doesn't fit your needs:
ng2-pdf-viewer: Minimal and lightweightng2-pdfjs-viewer: iframe-based, supports multiple PDFsYour feedback matters!
Just keep it respectful - the ngx-extended-pdf-viewer community is a friendly place, and I want to keep it that way!
FAQs
Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.
The npm package ngx-extended-pdf-viewer receives a total of 135,607 weekly downloads. As such, ngx-extended-pdf-viewer popularity was classified as popular.
We found that ngx-extended-pdf-viewer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Explore exportable charts for vulnerabilities, dependencies, and usage with Reports, Socket’s new extensible reporting framework.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.