Register print support
Add @univerjs-pro/slides-print when a Slides editor requires print preview or the print facade APIs. The package also provides locales under @univerjs-pro/slides-print/locale/*, so no separate CSS import is required.
import { UniverSlidesPrintPlugin } from '@univerjs-pro/slides-print'import SlidesPrintEnUS from '@univerjs-pro/slides-print/locale/en-US'import '@univerjs-pro/slides-print/facade'univer.registerPlugin(UniverSlidesPrintPlugin)Mobile support
Configure the mobile editor first. In the plugin-mode setup on this page, replace the desktop registrations below with the mobile exports from the same packages, and do so before opening a document. Keep the model plugins, styles, locales, and Facade imports, and register only one variant.
| Package | Desktop registration | Mobile registration |
|---|---|---|
@univerjs-pro/slides-print | UniverSlidesPrintPlugin | UniverSlidesPrintMobilePlugin |
Requirements
Register the core Slides model before the print plugin:
univer.registerPlugin(UniverSlidesPlugin)univer.registerPlugin(UniverSlidesUIPlugin)univer.registerPlugin(UniverSlidesPrintPlugin)A browser editor also requires the render engine, UI plugin, Docs, Drawing, and license plugins, as shown in the Quickstart.
Facade API
Import the facade entry to add printSlidesAsync to FUniver:
import '@univerjs-pro/slides-print/facade'Print every slide in the active presentation:
const univerAPI = FUniver.newAPI(univer)await univerAPI.printSlidesAsync()Print a selection by 1-based page number:
await univerAPI.printSlidesAsync({ range: [ { from: 1, to: 3 }, { from: 6, to: 6 }, ],})Print layout and preview
Choose full-page, handout, or notes-page output and open the built-in preview:
import { SlidePrintHandoutOrder, SlidePrintLayoutType } from '@univerjs-pro/slides-print'univerAPI.openSlidesPrintDialog({ layout: SlidePrintLayoutType.Handout, slidesPerPage: 6, handoutOrder: SlidePrintHandoutOrder.Horizontal, frameSlides: true, showSlideNumber: true,})The options also include paperSize, direction, margin, and marginCustom. A handout supports 1, 2, 3, 4, 6, or 9 slides per page.
range accepts inclusive page ranges. If the parameter is omitted, every slide prints. Overlapping ranges are de-duplicated and printed in slide order. A range that extends beyond the end of the deck is clipped to the slides that exist, and a reversed range is ignored.
Notes
Print output depends on the current slide snapshot, the page size, speaker notes, drawing elements, and any table or chart elements. If a deck can contain tables or charts, register those feature plugins before printing.
How is this guide?