Skip to content

About

lightweight pdf viewer for angular applications

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

ngx-pdf-viewer

Deploy Docs Angular TypeScript License: MIT

Headless, signal-based PDF viewer for Angular 21+, powered by pdfjs-dist — loaded from a CDN automatically, no separate install or wiring. No toolbar chrome, no NgModules — bring your own UI and get a fully typed, SSR-safe viewer API.

Quick Start

npm install @gavsby/ngx-pdf-viewer
import { Component } from '@angular/core';
import { PdfViewerComponent } from '@gavsby/ngx-pdf-viewer';

@Component({
  selector: 'app-document-viewer',
  standalone: true,
  imports: [PdfViewerComponent],
  template: ` <ngx-pdf-viewer [src]="src" (afterLoadComplete)="loaded($event)" (error)="failed($event)" /> `,
})
export class DocumentViewerComponent {
  src = '/assets/document.pdf';
  loaded(doc: unknown): void {}
  failed(err: unknown): void {}
}

Features

  • Lazy init via IntersectionObserver — pdf.js only loads when the viewer enters the viewport
  • Fit modes — page-width, page-height, page-fit plus manual zoom and original size
  • Rotation — rotate pages in 90° increments
  • Text layer — selectable/searchable text
  • Annotations & forms — configurable annotation display mode
  • Password support — async passwordProvider input for encrypted documents
  • Search / print / download / outline APIs — programmatic control from the host component
  • SSR-safe — the component no-ops on the server; safe for Angular Universal

Documentation

Full guides and API reference: https://subedigaurav.github.io/ngx-pdf-viewer/

Repo layout

This is a pnpm workspace with two projects:

License

MIT

About

lightweight pdf viewer for angular applications

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages