Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@page-speed/pdf-viewer

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@page-speed/pdf-viewer

High-performance PDF viewer for restaurant menus, catalogs, and documents

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
2
Created
Source

Page Speed React PDF Viewer

📑 @page-speed/pdf-viewer

High-performance, linearized PDF viewer for React applications.

Features

  • ⚡ Sub-1-second page rendering
  • 📄 Support for linearized PDFs with progressive loading
  • 🔍 Full-text search across all pages
  • 🔎 Zoom in/out with keyboard shortcuts
  • 📱 Mobile-responsive design
  • 🎯 Page navigation with input
  • 💾 Download & print support
  • 🎨 Customizable controls
  • 🚀 <30 KB base bundle (target)

Installation

You can install the package with any Node package manager:

npm install @page-speed/pdf-viewer
# or
pnpm add @page-speed/pdf-viewer
# or
yarn add @page-speed/pdf-viewer

Quick Start

import { PDFViewer } from '@page-speed/pdf-viewer';

export function MenuViewer() {
  return (
    <PDFViewer
      url="/menus/spring-menu.pdf"
      title="Spring Menu"
      height="600px"
      config={{
        showControls: true,
        enableDownload: true,
      }}
    />
  );
}

Configuration

PDFViewer accepts the following key props:

  • url: string – PDF URL or file path (required)
  • title?: string – optional document title
  • height?: string | number – container height (default 600px)
  • width?: string | number – container width (default 100%)
  • config?: Partial<PDFViewerConfig> – viewer configuration options

PDFViewerConfig includes:

  • initialPage?: number
  • initialZoom?: number | 'auto' | 'page-fit' | 'page-width'
  • textSelection?: boolean
  • search?: boolean
  • showControls?: boolean
  • showThumbnails?: boolean
  • enableDownload?: boolean
  • enablePrint?: boolean
  • enableFullscreen?: boolean
  • workerUrl?: string
  • cacheSize?: number
  • progressiveLoading?: boolean

Hooks & Utilities

In addition to the main PDFViewer component, this package exposes:

  • Hooks
    • usePDFDocument
    • usePageState
    • usePageRenderer
    • useZoom
    • useSearch
  • Components
    • PDFCanvas
    • PDFControls
    • PDFThumbnails
  • Utilities
    • isLinearizedPDF
    • downloadPDF
    • calculateScaleForPageFit
    • formatFileSize
    • extractPageText
    • linearizedPDFConfig
    • getOptimalRangeHeader
    • createProgressiveFetchHandler

License

MIT

Keywords

pdf

FAQs

Package last updated on 27 Mar 2026

Did you know?

Socket

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.

Install

Related posts