Core Features
Univer PDFs core provides a formal PDF unit, a durable edit layer, and a browser workbench. Imported PDF content remains the source baseline, while accepted changes are stored in the unit snapshot and rendered as the current document.
Features
- PDF unit model: Stores the source document, page structure, resources, and durable editing intent in
IPdfUnitData. - Page and element operations: Supports page navigation and insertion plus editable text, lists, tables, images, dividers, and annotations.
- Browser workbench: Renders PDF pages, thumbnails, selection, editing controls, clipboard behavior, and the inspector UI.
- Command pipeline: Applies accepted changes through durable commands and mutation batches so save, undo, and redo share one model.
- Facade API: Creates, finds, edits, and saves PDF units through application-facing PDF, page, element, and native-text objects.
Plugin Mode
Installation
pnpm add @univerjs/core @univerjs/design @univerjs/ui @univerjs-pro/license @univerjs-pro/pdfs @univerjs-pro/pdfs-uinpm install @univerjs/core @univerjs/design @univerjs/ui @univerjs-pro/license @univerjs-pro/pdfs @univerjs-pro/pdfs-uiyarn add @univerjs/core @univerjs/design @univerjs/ui @univerjs-pro/license @univerjs-pro/pdfs @univerjs-pro/pdfs-uibun add @univerjs/core @univerjs/design @univerjs/ui @univerjs-pro/license @univerjs-pro/pdfs @univerjs-pro/pdfs-uiUsage
import { UniverLicensePlugin } from '@univerjs-pro/license'import { UniverPdfsPlugin } from '@univerjs-pro/pdfs'import { UniverPdfsUIPlugin } from '@univerjs-pro/pdfs-ui'import PdfsUIEnUS from '@univerjs-pro/pdfs-ui/locale/en-US'import { LocaleType, mergeLocales, Univer } from '@univerjs/core'import { FUniver } from '@univerjs/core/facade'import DesignEnUS from '@univerjs/design/locale/en-US'import { UniverUIPlugin } from '@univerjs/ui'import UIEnUS from '@univerjs/ui/locale/en-US'import '@univerjs-pro/pdfs/facade'import '@univerjs/design/lib/index.css'import '@univerjs/ui/lib/index.css'import '@univerjs-pro/pdfs-ui/lib/index.css'const univer = new Univer({ locale: LocaleType.EN_US, locales: { [LocaleType.EN_US]: mergeLocales(DesignEnUS, UIEnUS, PdfsUIEnUS), },})univer.registerPlugin(UniverUIPlugin, { container: 'app' })univer.registerPlugin(UniverLicensePlugin, { license: process.env.CLIENT_LICENSE_TEXT,})univer.registerPlugin(UniverPdfsPlugin)univer.registerPlugin(UniverPdfsUIPlugin)const univerAPI = FUniver.newAPI(univer)const pdf = univerAPI.createPdf({ name: 'Untitled PDF' })UniverPdfsPlugin owns the PDF unit and durable commands. UniverPdfsUIPlugin owns the browser viewer and its editing controls. For viewer-only UI, register UniverPdfsUIPlugin with { editor: { enabled: false } }. Collaboration-backed applications can additionally register @univerjs-pro/pdfs-editor together with the collaboration plugins it requires.
Preset Mode
Univer PDFs does not currently export a preset package. Create PDF applications with Plugin Mode.
Menu order and grid layout
Configure menu and ribbonType in the existing UniverUIPlugin registration. These are shared UI options; they do not belong to UniverPdfsUIPlugin. The example uses menu IDs from PDFs:
Initial configuration
import type { MenuConfig } from '@univerjs/ui'import { UniverUIPlugin } from '@univerjs/ui'const menu: MenuConfig = { 'ribbon.view': { order: -1 }, 'ribbon.start.layout': { order: -1 }, 'pdf.menu.tool.highlight': { order: 1, gridLayout: { row: 2, column: 1 }, }, 'pdf.menu.tool.ink': { order: 0, gridLayout: { row: 1, column: 1 }, },}univer.registerPlugin(UniverUIPlugin, { container: 'app', ribbonType: 'grid', menu })order sorts sibling tabs, groups, or menu items in ascending order; it does not move an item between groups. Use the actual menu item ID, available from its data-u-command attribute, rather than assuming it is the command ID.
Runtime updates
Import @univerjs/ui/facade before creating univerAPI with FUniver.newAPI(univer). updateMenuConfig() merges the changes, preserves unspecified fields, and refreshes the menus. Overrides also apply to menus registered later.
import '@univerjs/ui/facade'univerAPI.updateMenuConfig({ 'pdf.menu.tool.highlight': { gridLayout: { row: 2, column: 1, showLabel: true, width: 96 } },})gridLayout only affects the grid Ribbon. Each group has two rows, and row and column start at 1. Explicit positions take precedence over visual ordering by order; update both items when swapping occupied cells. Optional fields inherit the existing configuration or schema. See IRibbonGridLayout for spans, labels, widths, and icon sizes.
Keep editing enabled in UniverPdfsUIPlugin: editor.enabled: false skips registration of the product Ribbon. Menu overrides do not register missing buttons.
For custom buttons and submenu triggers, createMenu() and createSubmenu() also accept order and gridLayout; call appendTo() to register them. The popup contents do not use the Ribbon grid layout.
How is this guide?