EmbedPDF Documentation

repository·main·Indexed 26 days ago

https://github.com/embedpdf/embed-pdf-viewer

A high-performance, framework-agnostic JavaScript PDF viewer for modern web applications. EmbedPDF supports true redaction, various annotation types, and provides integrations for React, Vue, and Preact. It features a modular plugin system for capabilities such as virtualized scrolling, zoom, rotation, text search, and thumbnail sidebars, powered by the @embedpdf/core and @embedpdf/engines packages.

Tokens
260.6K
Snippets
572
Records
1.1K
Agent score
86%

What's inside EmbedPDF

  1. Introduction to @embedpdf/vue-pdf-viewer

    main

    The @embedpdf/vue-pdf-viewer package is a production-ready, drop-in PDF viewer component for Vue applications. It provides a complete UI out of the box, including a toolbar, sidebar, and thumbnails, eliminating the need to build custom layout logic or CSS for PDF viewing.

    Key Features:

    • Ready-to-use UI: Includes polished toolbars, sidebars, and thumbnails.
    • Responsive: Adapts to both mobile and desktop screens.
    • Themable: Supports light/dark modes and custom brand colors.
    • Configurable: Allows disabling specific features like printing or downloading.
    • TypeScript Support: Fully typed for enhanced developer experience.
  2. Overview of EmbedPDF

    main
    EmbedPDF is an open-source, MIT-licensed, framework-agnostic JavaScript PDF viewer. It is designed to be integrated into any JavaScript project, including those built with React, Vue, Svelte, Preact, or vanilla JS. It provides a modern reading experience with features like virtualized scrolling and a pluggable architecture.
  3. Overview of @embedpdf/pdfium features

    main

    The @embedpdf/pdfium package brings native-quality PDF capabilities to the browser via WebAssembly. Key features include:

    • High-fidelity rendering of PDF pages
    • Text extraction and search
    • Form filling and manipulation
    • Annotation support
    • Digital signature verification
    • PDF modification and creation
  4. Overview of EmbedPDF Snippet

    main

    The EmbedPDF Snippet is a production-ready, 'batteries included' PDF viewer designed for rapid integration. Unlike headless libraries that require manual UI construction, the Snippet provides a complete, professional interface including toolbars, sidebars, search, and annotations out of the box.

    Key Benefits:

    • Instant Integration: Minimal code required for setup.
    • Polished UI: Automatic handling of zooming, scrolling, searching, and thumbnails.
    • Framework Agnostic: Compatible with React, Vue, Svelte, Angular, or plain HTML/jQuery.
    • Customizable: Supports theming and feature toggling via a configuration object.
  5. Overview of @embedpdf/models features

    main

    The @embedpdf/models package serves as the single source of truth for data shapes and utilities across all EmbedPDF runtimes and UI packages. Key features include:

    • Rich PDF Domain Model: Type definitions for documents, pages, bookmarks, annotations, form fields, permissions, and search.
    • Geometry API: Helpers for positions, quads, and rectangles (e.g., transformRect, rotateRect, boundingRect).
    • Task Abstraction: A Promise-like Task abstraction for managing cancellable and abortable asynchronous workflows.
    • Logger: A logger with pluggable transports and log-level filtering.
    • Utility Helpers: Functions like unionFlags and PdfTaskHelper.
  6. Understand Headless Components in @embedpdf/svelte

    main

    The @embedpdf/svelte headless library is an unopinionated UI toolkit designed for building fully customized PDF experiences. Unlike the Drop-in Viewer, the headless library provides the underlying logic via stores and rendering primitives via components, but it includes zero styling.

    Core Concepts

    • UI Control: You are responsible for the visual implementation. You can use your own button components, CSS (such as Tailwind or scoped styles), and layouts.
    • Composability: You build your viewer by composing specialized components (e.g., <RenderLayer />, <Scroller />) and stores (e.g., useSearch, useSelection).
    • Minimal Bundle Size: The library is tree-shakeable; you only import the specific plugins you need (e.g., if you do not need annotations, do not import the annotation plugin).
  7. Core technologies in EmbedPDF React

    main

    Regardless of whether you choose the Drop-in Viewer or Headless Components, the underlying technology remains the same:

    • PDFium via WebAssembly: Uses the same rendering engine found in Google Chrome.
    • Virtualization: Only renders pages currently visible in the viewport, enabling smooth handling of documents with 1000+ pages.
    • First-class TypeScript: Provides full type definitions.
    • Tree-shakeable: Supports tree-shaking to ensure you only include the code you actually use in your bundle.
  8. EmbedPDF Key Features

    main

    EmbedPDF includes the following core capabilities:

    • Annotations: Support for highlighting, sticky notes, free text, and ink.
    • True Redaction: Content is physically removed from the document.
    • Navigation & Viewing: Search, text selection, zoom, and rotation.
    • Performance: Smooth, virtualized scrolling.
    • Extensibility: Pluggable architecture and tree-shakable plugins.
  9. Choose a Redaction Operating Mode

    main

    The Redaction Plugin supports two modes depending on your workflow requirements:

    1. Legacy Mode: Pending redactions are stored in internal state. This is a simple setup suitable for single-session workflows where a user marks and applies redactions immediately.
    2. Annotation Mode: Pending redactions are stored as PDF REDACT annotations. This enables collaborative workflows, customizable colors, and undo/redo support.
  10. Core technologies used by Svelte PDF Viewer

    main

    Regardless of the integration path chosen, the Svelte PDF Viewer utilizes the following technologies:

    • PDFium via WebAssembly: Uses the same rendering engine as Google Chrome for high fidelity.
    • Virtualization: Optimizes performance by only rendering visible pages, enabling smooth handling of documents with 1000+ pages.
    • First-class TypeScript: Provides full type definitions.
    • Tree-shakeable: Supports modular imports to keep bundle sizes small.