API Reference

PDF

Packages@univerjs-pro/pdfs

Facade APIs for creating, reading, and editing Univer PDF units.

Import @univerjs-pro/pdfs/facade before using these APIs in plugin mode.

For setup and task-oriented examples, start with the Univer PDFs guide.

Unit access

TypeScript
createPdf(data?: Partial<IPdfUnitData>, options?: ICreateUnitOptions): FPdfgetActivePdf(): FPdf | nullgetPdf(id: string): FPdf | nullgetPdfTableThemePresets(): ReadonlyArray<Readonly<IPdfTableThemePreset>>

FPdf

CategoryMethods
Identity and datagetId, getName, save, getDocument, getModel
PagesinsertPage, getPages, getPageById, getPageByIndex
TypeScript
getId(): stringgetName(): stringsave(): IPdfUnitDatagetDocument(): IPdfDocumentgetModel(): PdfDocumentModelinsertPage(index?: number): FPdfPagegetPages(): FPdfPage[]getPageById(id: string): FPdfPage | nullgetPageByIndex(index: number): FPdfPage | null

FPdfPage

FPdfPage resolves existing page elements and inserts editable text boxes, paragraphs, lists, tables, dividers, annotations, and images.

TypeScript
getId(): stringgetIndex(): numbergetData(): Readonly<IPdfPage>getElements(): FPdfPageElement[]getElementById(id: string): FPdfPageElement | nullgetTextBoxes(): FPdfTextBox[]getImages(): FPdfImage[]getParagraphs(): FPdfParagraph[]getLists(): FPdfList[]getTables(): FPdfTable[]getDividers(): FPdfDivider[]getAnnotations(): FPdfAnnotation[]getTextSpans(): FPdfTextSpan[]insertTextBox(options: IPdfTextBoxInsertOptions): FPdfTextBoxinsertParagraph(options: IPdfParagraphInsertOptions): FPdfParagraphinsertList(options: IPdfListInsertOptions): FPdfListinsertTable(options: IPdfTableInsertOptions): FPdfTableinsertDivider(options?: IPdfDividerInsertOptions): FPdfDividerinsertAnnotation(options: IPdfAnnotationInsertOptions): FPdfAnnotationnewImage(existing?: FPdfImage | string): FPdfImageBuilderinsertImage(info: IPdfImageBuilderInfo, index?: number): FPdfImageinsertImageAsync(source: string | IFBlobSource, options?: IPdfImageInsertOptions): Promise<FPdfImage>

Page elements

Every FPdfPageElement supports identity, transform, visibility, locking, z-order, and removal. Specialized wrappers add content editing:

WrapperMethods
FPdfTextBoxgetText, getTextRuns, setText, setTextStyle, getTextAnchor, setTextAnchor
FPdfParagraphgetBlocks, insertBlock, appendBlock, setBlockText, setBlockStyle, removeBlock
FPdfListgetItems, insertItem, setItemText, removeItem, changeItemLevel, setPreset, setStartNumber
FPdfTablegetRowCount, getColumnCount, getCell, resize, getTheme, setTheme
FPdfTableCellgetText, setText, getStyle, setStyle
FPdfDividergetStroke, setStroke
FPdfAnnotationgetAnnotationType, getMarkup, getInk, getStyle, setStyle
FPdfImagegetSource, getImageSourceType, setSource, getCrop, setCrop, getOpacity, setOpacity, toBuilder
FPdfTextSpangetId, getText, getTextRuns, getBounds, replaceText
TypeScript
// FPdfPageElementgetId(): stringgetType(): PdfObjectTypegetData(): Readonly<PdfObject>getTransform(): IPdfFacadeTransformsetTransform(transform: IPdfFacadeTransform): thissetPosition(left: number, top: number): thissetSize(width: number, height: number): thissetRotation(rotation: number): thissetVisible(visible: boolean): thissetLocked(locked: boolean): thisbringToFront(): thissendToBack(): thisbringForward(): thissendBackward(): thisremove(): void
TypeScript
import '@univerjs-pro/pdfs/facade'const pdf = univerAPI.createPdf({ name: 'Project brief' })const page = pdf.insertPage()page.insertTextBox({ text: 'Hello PDF', left: 36, top: 36 }).setTextStyle({ fontSize: 18, fill: '#274690' })page.insertTable({  rowCount: 2,  columnCount: 2,  cellTexts: ['Metric', 'Value', 'Users', '42'],})const snapshot = pdf.save()

PDF facade enums include PdfAnnotationType, PdfListKind, PdfListPresetId, PdfTextAnchor, and PdfTableCellVerticalAlign through univerAPI.Enum.

For browser printing, see @univerjs-pro/pdfs-print.

Source: @univerjs-pro/pdfs

How is this guide?

© 2026 DreamNum Co., Ltd.