@univerjs-pro/pdfs-print adds a Print action for the active PDF in the browser. It materializes the current pages and opens the system print dialog.
Register printing
pnpm add @univerjs-pro/pdfs-printnpm install @univerjs-pro/pdfs-printyarn add @univerjs-pro/pdfs-printbun add @univerjs-pro/pdfs-printAdd the print locale and stylesheet to the browser setup, then register the plugin after UniverPdfsUIPlugin:
import { UniverPdfsPrintPlugin } from '@univerjs-pro/pdfs-print'import PdfsPrintEnUS from '@univerjs-pro/pdfs-print/locale/en-US'import '@univerjs-pro/pdfs-print/lib/index.css'// Merge PdfsPrintEnUS with PdfsUIEnUS and the shared UI locales.univer.registerPlugin(UniverPdfsPrintPlugin)The plugin adds its own menu item and printing progress UI. FUniver provides no PDF print method, so printing starts from the registered browser UI.
Printing commits text that is still being edited on the canvas before it materializes pages, so the printed result matches the current document.
Mobile support
Set up the mobile editor first, then replace UniverPdfsPrintPlugin with UniverPdfsMobilePrintPlugin from the same package. It requires UniverPdfsMobileUIPlugin and UniverMobileUIPlugin, adds Print to the mobile viewer and read-only menus, and scales page canvases down when a document exceeds the mobile pixel budget.
Print is not file export
| Workflow | Result | Server required | Environment |
|---|---|---|---|
| Opens the browser or operating system print dialog | No | Browser only | |
| Export | Returns a converted PDF File for application-controlled download | Yes | Exchange client |
The print dialog may offer “Save as PDF”, but that option comes from the browser. When an application needs a PDF file object, a download flow under its own control, or server-side conversion, it should use exportPdfByUnitIdAsync or exportPdfBySnapshotAsync.
How is this guide?