Skip to content

Quickstart

Put a PDF on screen with tools above it and page and zoom controls below. This page assumes a Vite project.

You need the core, the theme and the package for your framework. The packages share one version number.

Terminal window
pnpm add @inkbar/vue @inkbar/core @inkbar/theme

PDF.js loads a worker, fonts and decoders at runtime. The plugin serves those files in development and copies them into your build. It works with Vite 6 or later.

vite.config.ts
import { inkbar } from '@inkbar/core/vite'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [inkbar()],
})

Wrap the viewport in a root. Put a toolbar of tools, undo and redo above it and a page and zoom bar below, then add the popovers for notes and suggested redactions.

Review.vue
<script setup lang="ts">
import {
InkRoot,
InkViewport,
InkToolbar,
InkToolButton,
InkToolbarSeparator,
InkUndo,
InkRedo,
InkPrevPage,
InkPageInput,
InkPageCount,
InkNextPage,
InkZoomSelect,
InkNotePopover,
InkSuggestionCard,
} from '@inkbar/vue'
import { assets } from 'virtual:inkbar-assets'
import '@inkbar/theme/theme.css'
defineProps<{ url: string; id: string }>()
</script>
<template>
<InkRoot :src="{ url, key: id }" :assets="assets">
<InkToolbar>
<InkToolButton tool="view" />
<InkToolButton tool="select" />
<InkToolButton tool="highlight" />
<InkToolButton tool="redact-area" />
<InkToolButton tool="note" />
<InkToolbarSeparator />
<InkUndo />
<InkRedo />
</InkToolbar>
<InkViewport />
<InkToolbar label="Page and zoom">
<InkPrevPage />
<InkPageInput />
<InkPageCount />
<InkNextPage />
<InkZoomSelect />
</InkToolbar>
<InkNotePopover />
<InkSuggestionCard />
</InkRoot>
</template>

The viewer fills its parent, so give the parent a height. Without one, the document has no room to scroll. Each control is its own component: drop the ones you don’t need, move them, or add your own buttons. Toolbars covers them.

Inkbar keeps the annotations itself here, with undo and redo. To hold them in your own state, read Controlled mode. Annotations live in memory until you save them: Annotations shows how to store them as JSON.