Basic Usage
Learn how to use Lector's core components and features
Lector provides a set of composable components that you can use to build a custom PDF viewer. This guide will walk you through the core concepts and basic usage.
Core Concepts
Lector follows a component-based architecture with three main layers:
- Root Container: Manages the PDF document state and context
- Pages Container: Handles page layout and virtualization
- Layer Components: Render different aspects of each page (canvas, text, annotations)
Basic Setup
First, set up the PDF.js worker:
Creating a Basic Viewer
Here's a minimal example of a PDF viewer:
Core Components
Root Component
The Root
component is the main container that manages the PDF document state:
Pages Component
The Pages
component handles page layout and virtualization:
Page Layers
Each page can have multiple layers for different functionality:
Common Features
Adding Zoom Controls
Adding Page Navigation
Supported Features
Lector includes support for:
- 📱 Responsive layout with automatic page scaling
- 🖱️ Pan and zoom with mouse/touch controls
- ✨ Text selection and copying
- 🔗 Internal and external link handling
- 📑 Page thumbnails and outline navigation
- 🎨 Custom rendering and annotations
- 🌗 Dark mode support
Next Steps
Check out these guides to learn more: