Core Features

Plugins Info

Univer PDFs provides a formal PDF unit, a durable edit layer, and a browser workbench. The imported PDF remains the baseline; 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: Inserts pages, navigates between pages, and works with editable text, lists, tables, images, dividers, and annotations.
  • Browser workbench: Renders PDF pages and thumbnails, manages selection, editing controls, and clipboard behavior, and provides the inspector UI.
  • Command pipeline: Applies accepted changes through durable commands and mutation batches, so save, undo, and redo operate on one model.
  • Facade API: Creates, finds, edits, and saves PDF units through application-facing PDF, page, element, and native-text objects.

Plugin mode

Installation

Shell
pnpm add @univerjs/core @univerjs/design @univerjs/ui @univerjs-pro/license @univerjs-pro/pdfs @univerjs-pro/pdfs-ui

Usage

TypeScript
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' })

Plugin configuration

UniverLicensePlugin

  • license
    string
    Contents of the client license file.

UniverPdfsUIPlugin

  • editor
    object
    Enables the PDF editor or the Slides editor controls.
    • enabled
      booleanDefault: true
      Enables the PDF editor or the Slides editor controls.
  • thumbnailWorkerURL
    string | URL | Worker
    Renders thumbnails in a browser Worker.

UniverPdfsPlugin owns the PDF unit and the 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 also register @univerjs-pro/pdfs-editor together with the collaboration plugins it requires.

UniverUIPlugin

  • container
    string | HTMLElement
    Element to mount into, or its DOM ID.
  • menu
    Record<string, object>
    Order, placement, and visibility of menu items.
    • [id]
      object
      An override for this menu item, Ribbon tab, or Ribbon group.
      • order
        number
        Position among siblings. Lower values come first.
      • hidden
        boolean
        Hides the item.
      • disabled
        boolean
        Disables the item.
      • activated
        boolean
        Shows the item as active.
      • title
        string
        Title or translation key.
      • tooltip
        string
        Tooltip or translation key.
      • icon
        string | Observable<string>
        Icon name, or an Observable that supplies it.
      • type
        MenuItemType
        How the item is presented: button, selector, button selector, or submenu.
      • commandId
        string
        Command the item runs.
      • description
        string
        Description of the item.
      • slot
        boolean
        Reserves a slot for custom rendering.
      • label
        string | object
        Label text, or a custom label component.
      • params
        Record<string, unknown> | (() => Record<string, unknown> | undefined)
        Arguments passed to the command, or a function that returns them.
      • gridLayout
        object
        Placement in the grid Ribbon.
        • row
          1 | 2
          Row 1 or 2 within the group.
        • column
          number
          Column within the group, starting at 1.
        • rowSpan
          1 | 2Default: 1
          Number of rows the item occupies.
        • columnSpan
          numberDefault: 1
          Number of columns the item occupies.
        • showLabel
          booleanDefault: false
          Shows the title next to the icon.
        • width
          number
          Control width in pixels.
        • minWidth
          number
          Minimum width in pixels before the group moves into More.
        • iconSize
          number
          Icon size in pixels.
  • ribbonType
    RibbonTypeDefault: classic
    Selects the Ribbon layout.

Configure menu and ribbonType in the existing UniverUIPlugin registration. These are shared UI options and do not belong to UniverPdfsUIPlugin. The example uses actual menu IDs from PDFs:

TypeScript
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.

Preset mode

Univer PDFs does not currently provide a preset package. Create PDF applications in Plugin Mode.

Editing and viewing controls

The PDF Ribbon is built on the shared Univer ribbon. Start provides undo and redo, clipboard actions, the interaction-mode selector, page organization and insertion, and printing. Insert adds text boxes, images, paragraphs, dividers, tables, and lists. Annotations groups highlight, underline, and strikethrough with freehand drawing and pen options. View provides zoom, full screen, annotation visibility, continuous scrolling, and the properties panel. Selecting text, a table, or an image opens the matching contextual Text, Table, or Image tab, which also hosts the properties panel, table styling, and image transform actions. These Ribbon controls require the default editor.enabled: true setting in UniverPdfsUIPlugin.

Runtime updates

Import @univerjs/ui/facade before creating univerAPI with FUniver.newAPI(univer). updateMenuConfig() merges the changes, preserves unspecified fields, and refreshes the menus. The overrides also apply to menus registered later.

TypeScript
import '@univerjs/ui/facade'univerAPI.updateMenuConfig({  'pdf.menu.tool.highlight': { gridLayout: { row: 2, column: 1, showLabel: true, width: 96 } },})

gridLayout affects only the grid Ribbon. Each group has two rows, and row and column start at 1. An explicit position takes precedence over the visual order set by order, so update both items when two occupied cells are swapped. 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, and menu overrides do not register missing buttons.

For custom buttons and submenu triggers, createMenu() and createSubmenu() also accept order and gridLayout; appendTo() registers them. The popup content does not use the Ribbon grid layout.

How is this guide?

© 2026 DreamNum Co., Ltd.