---
title: Quick start
description: Build a PDF viewer step by step, with text selection, zoom buttons, a highlighter and a save button.
---
{/* Generated from docs/content — edit there, then `pnpm docs:sync`. */}
import { Cards, Card } from '@/components/docs/cards';
# Quick start
This guide builds a small PDF viewer: the pages, text people can select, zoom buttons, a
highlighter and a save button. Each step adds one plugin or one control, so you can stop at any
step and have a working viewer.
## 1. Install
You need two packages: the one for your framework, and an engine.
```sh npm2yarn
npm install @embedpdf/react @embedpdf/engine
```
```sh npm2yarn
npm install @embedpdf/react @cloudpdf/engine
```
```sh npm2yarn
npm install @embedpdf/vue @embedpdf/engine
```
```sh npm2yarn
npm install @embedpdf/vue @cloudpdf/engine
```
```sh npm2yarn
npm install @embedpdf/svelte @embedpdf/engine
```
```sh npm2yarn
npm install @embedpdf/svelte @cloudpdf/engine
```
```sh npm2yarn
npm install @embedpdf/angular @embedpdf/engine
```
```sh npm2yarn
npm install @embedpdf/angular @cloudpdf/engine
```
Every feature is a separate import from the framework package, such as `@embedpdf/react/stage`,
so what you don't use never reaches your bundle.
## 2. Show a PDF
Create the engine once, then give it to `` with the plugins you want and the document to
open. `` shows the pages, and `` draws each one:
`localEngine()` costs nothing until it's used, so creating it at the top of a module is safe, even
with server-side rendering. The viewer starts it when it mounts: PDFium boots in a Web Worker in
the background, and the first page shows as soon as the document is open. The engine's
WebAssembly is part of your build and loads from your own site; see [Setup](setup).
`localEngine()` costs nothing until it's used, so it's safe in your component, even with
server-side rendering. The viewer starts it in the browser: PDFium boots in a Web Worker in the
background, and the first page shows as soon as the document is open. The engine's WebAssembly is
part of your build and loads from your own site; see [Setup](setup).
`cloudEngine()` holds an HTTP client and nothing else, so creating it at the top of a
module is safe, even with server-side rendering. Every page, text and annotation call goes to your
CloudPDF server; see [Setup](setup).
`` shows its `fallback` until the document is open, so the Stage never renders
without one.
{/* readme: end */}
## 3. Let people select text
Add the interaction plugin, which handles the pointer for every feature, and the selection plugin.
Then put `` above the page:
Drag over text to select it, double-click a word, or triple-click a line. On a phone, long-press a
word. See [Selecting & copying](text/selection) for copying and a selection menu.
## 4. Add zoom buttons
Every plugin has a for its API and one for its state. `useStage()` does things,
and `useStageState()` gives you what to show:
Every plugin has a service with its methods and its state as signals, and the Stage has
`EpdfStageRef`. Next to the Stage in a template, its template reference, `#stage="epdfStage"`,
gives you both:
Put `` anywhere inside ``. It when the zoom
changes, whether a button, a pinch or code changed it.
The buttons go inside `*epdfDocumentGate`, next to the stage they name. The percentage updates when
the zoom changes, whether a button, a pinch or code changed it.
## 5. Add a highlighter
The annotation plugin shows the annotations a PDF already has, and lets people add their own. Add
it with its layer, and a button that turns on the highlight tool:
With the tool on, select text and it's highlighted. Click a highlight with the `pointer` tool to
select it. The page picture leaves the annotations out by itself, because the annotation layer
draws them now. The component that provides the viewer can inject its services
too, so the button needs no component of its own. See [Annotations](annotations) for every
tool.
## 6. Save
`documents.download()` gives you the PDF with every change, as bytes. `saveFile` hands them to the
browser as a download:
Put `` anywhere inside ``.
Put `` anywhere in the template of the component that provides
the viewer: it injects the service from there.
You don't need to save to keep the highlights: the server stored each one as it was made.
`download()` is for when you want the file itself.
## Next steps