npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ng-simple-pdf-viewer

v1.1.9

Published

A modern, lightweight Angular PDF viewer component with advanced features including scroll-based page tracking, floating toolbar, and seamless navigation.

Readme

ng-simple-pdf-viewer

A modern, lightweight Angular PDF viewer component with advanced features including scroll-based page tracking, floating toolbar, and seamless navigation.

Features

  • 📄 Full PDF Rendering: Based on Mozilla's PDF.js library for reliable PDF display
  • 🎯 Smart Page Tracking: Automatically updates current page based on scroll position
  • 🎨 Floating Toolbar: Modern translucent overlay that becomes opaque on interaction
  • 🖨️ Print Support: Built-in print functionality with proper PDF handling
  • 📱 Responsive Design: Adapts to different screen sizes and orientations
  • Smooth Navigation: Programmatic and scroll-based page navigation
  • 🎭 Customizable UI: Toggle toolbar elements and styling options
  • 🔄 Auto-scaling: Pages automatically scale to fit container width

Installation

Choose your preferred package manager:

# npm
npm install ng-simple-pdf-viewer

# yarn
yarn add ng-simple-pdf-viewer

# pnpm
pnpm add ng-simple-pdf-viewer

# bun
bun add ng-simple-pdf-viewer

Usage

Basic Usage

<ng-simple-pdf-viewer url="https://example.com/document.pdf" file-name="My Document.pdf"> </ng-simple-pdf-viewer>

Advanced Usage with Customization

<ng-simple-pdf-viewer url="https://example.com/document.pdf" file-name="My Document.pdf" [show-toolbar]="true" [show-download-button]="true" [show-print-button]="true" (on-load)="onPdfLoaded($event)" (on-page-change)="onPageChanged($event)" (on-error)="onPdfError($event)"> </ng-simple-pdf-viewer>

Component Integration

import { NgPdfViewerComponent } from "ng-simple-pdf-viewer";

@Component({
  selector: "app-pdf-viewer",
  standalone: true,
  imports: [NgPdfViewerComponent],
  template: ` <ng-simple-pdf-viewer [url]="pdfUrl" [file-name]="fileName" (on-page-change)="handlePageChange($event)"> </ng-simple-pdf-viewer> `,
})
export class PdfViewerComponent {
  pdfUrl = "https://example.com/document.pdf";
  fileName = "Document.pdf";

  handlePageChange(pageNumber: number) {
    console.log("Current page:", pageNumber);
  }
}

Input Properties

| Property | Type | Default | Description | | ---------------------- | ---------------- | ---------- | ------------------------------------ | | url | string \| null | null | URL of the PDF file to display | | file-name | string \| null | null | Name for downloaded file | | show-toolbar | boolean | true | Show/hide the floating toolbar | | show-download-button | boolean | true | Show/hide the download button | | show-print-button | boolean | true | Show/hide the print button | | on-load | Function | () => {} | Callback when PDF loads successfully | | on-page-change | Function | () => {} | Callback when current page changes | | on-error | Function | () => {} | Callback when PDF loading fails |

Output Events

| Event | Type | Description | | ---------------- | ------------------------------ | ------------------------------------------------------------ | | on-load | (pdfDoc: any) => void | Emitted when PDF document loads successfully | | on-page-change | (pageNumber: number) => void | Emitted when the current page changes (scroll or navigation) | | on-error | (error: any) => void | Emitted when PDF loading or rendering fails |

Public Methods

| Method | Parameters | Description | | --------------------------- | ----------------- | ------------------------------ | | nextPage() | None | Navigate to the next page | | prevPage() | None | Navigate to the previous page | | goToPage(pageNum: number) | pageNum: number | Jump to a specific page number | | downloadPdf() | None | Download the current PDF file | | printPdf() | None | Print the current PDF file |

Styling

The component uses CSS custom properties and can be styled using standard CSS:

ng-simple-pdf-viewer {
  --first-page-height: 600px; /* Set initial container height */
}

/* Customize toolbar appearance */
.document-toolbar {
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
}

/* Customize page styling */
.document-page {
  margin: 2rem 0;
}

Browser Support

  • Chrome 60+
  • Firefox 55+
  • Safari 12+
  • Edge 79+

Dependencies

  • Angular 15+
  • PDF.js (included)

License

MIT