Print functionality allows users to print document content as physical documents or export it to PDF format for offline viewing and sharing.
Preset Mode
The print functionality is included in the @univerjs/preset-docs-advanced preset.
Installation
The UniverDocsAdvancedPreset preset from @univerjs/preset-docs-advanced depends on the UniverDocsDrawingPreset preset at runtime. Please install @univerjs/preset-docs-drawing first.
npm install @univerjs/preset-docs-drawing @univerjs/preset-docs-advancedUsage
import { UniverDocsAdvancedPreset } from '@univerjs/preset-docs-advanced'
import UniverPresetDocsAdvancedEnUS from '@univerjs/preset-docs-advanced/locales/en-US'
import { UniverDocsCorePreset } from '@univerjs/preset-docs-core'
import UniverPresetDocsCoreEnUS from '@univerjs/preset-docs-core/locales/en-US'
import { UniverDocsDrawingPreset } from '@univerjs/preset-docs-drawing'
import UniverPresetDocsDrawingEnUS from '@univerjs/preset-docs-drawing/locales/en-US'
import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'
import '@univerjs/preset-docs-core/lib/index.css'
import '@univerjs/preset-docs-drawing/lib/index.css'
import '@univerjs/preset-docs-advanced/lib/index.css'
const { univerAPI } = createUniver({
locale: LocaleType.EN_US,
locales: {
[LocaleType.EN_US]: mergeLocales(
UniverPresetDocsCoreEnUS,
UniverPresetDocsDrawingEnUS,
UniverPresetDocsAdvancedEnUS,
),
},
presets: [
UniverDocsCorePreset(),
UniverDocsDrawingPreset(),
UniverDocsAdvancedPreset(),
],
})If you have a commercial license for Univer, please refer to Using License in Client for configuration.
Plugin Mode
Installation
npm install @univerjs-pro/docs-printUsage
import { UniverDocsPrintPlugin } from '@univerjs-pro/docs-print'
import DocsPrintPluginEnUS from '@univerjs-pro/docs-print/locale/en-US'
import { LocaleType, mergeLocales, Univer } from '@univerjs/core'
import '@univerjs-pro/docs-print/lib/index.css'
const univer = new Univer({
locale: LocaleType.EN_US,
locales: {
[LocaleType.EN_US]: mergeLocales(
DocsPrintPluginEnUS,
),
},
})
univer.registerPlugin(UniverDocsPrintPlugin) If you have a commercial license for Univer, please refer to Using License in Client for configuration.
How is this guide?
