API Reference

FPdfParagraph

Facade for one story-backed editable paragraph frame.

Access

Access through:

Inheritance

Extends FPdfPageElement. Its inherited members are available on this object.

Example

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const paragraph = page.insertParagraph({  text: 'First paragraph',  fontSize: 24,})console.log(paragraph.getBlocks())paragraph.appendBlock({  text: 'Second paragraph',  textStyle: {    fontSize: 18,    bold: true,  },})const block = paragraph.getBlocks()[0]paragraph  .setBlockText(block.id, 'Updated first paragraph')  .setBlockStyle(block.id, { align: 'center' })

Setup

Register @univerjs-pro/pdfs or a preset that includes it. In plugin mode, import @univerjs-pro/pdfs/facade. Additional methods below require their listed plugin packages. See Facade setup.

@univerjs-pro/pdfs

FPdfParagraph.appendBlock

Append one stable paragraph block.

TypeScript
appendBlock(block: IPdfParagraphBlockInput): this

Parameters

  • block — Required. The new block data.

Returns

This paragraph Facade for chaining.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const paragraph = page.getParagraphs()[0]if (paragraph) {  paragraph.appendBlock({    text: 'Last paragraph',    textStyle: {      fontSize: 16,      underline: true,    },  })}

Types: IPdfParagraphBlockInput

Package: @univerjs-pro/pdfs · Type definitions

FPdfParagraph.getBlocks

Return detached paragraph blocks in story order.

TypeScript
getBlocks(): readonly IPdfParagraphBlockSnapshot[]

Returns

The current block snapshots.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const paragraph = page.getParagraphs()[0]console.log(paragraph?.getBlocks())

Types: IPdfParagraphBlockSnapshot

Package: @univerjs-pro/pdfs · Type definitions

FPdfParagraph.insertBlock

Insert one stable paragraph block at a zero-based index.

TypeScript
insertBlock(index: number, block: IPdfParagraphBlockInput): this

Parameters

  • index — Required. The insertion index.
  • block — Required. The new block data.

Returns

This paragraph Facade for chaining.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const paragraph = page.getParagraphs()[0]if (paragraph) {  paragraph.insertBlock(0, {    text: 'Inserted paragraph',    textStyle: {      fontSize: 20,      italic: true,    },  })}

Types: IPdfParagraphBlockInput

Package: @univerjs-pro/pdfs · Type definitions

FPdfParagraph.removeBlock

Remove one stable paragraph block.

TypeScript
removeBlock(blockId: string): this

Parameters

  • blockId — Required. The stable block ID.

Returns

This paragraph Facade for chaining.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const paragraph = page.getParagraphs()[0]const block = paragraph?.getBlocks()[0]if (paragraph && block) {  paragraph.removeBlock(block.id)}

Package: @univerjs-pro/pdfs · Type definitions

FPdfParagraph.setBlockStyle

Apply paragraph layout properties to one stable block.

TypeScript
setBlockStyle(blockId: string, style: IPdfParagraphStyle): this

Parameters

  • blockId — Required. The stable block ID.
  • style — Required. The paragraph style patch.

Returns

This paragraph Facade for chaining.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const paragraph = page.getParagraphs()[0]const block = paragraph?.getBlocks()[0]if (paragraph && block) {  paragraph.setBlockStyle(block.id, {    align: 'center',  })}

Types: IPdfParagraphStyle

Package: @univerjs-pro/pdfs · Type definitions

FPdfParagraph.setBlockText

Replace the text in a generated paragraph block.

TypeScript
setBlockText(blockId: string, text: string): this

Parameters

  • blockId — Required. The stable block ID.
  • text — Required. The replacement text.

Returns

This paragraph Facade for chaining.

Examples

TypeScript
const pdf = univerAPI.getActivePdf()const page = pdf.getPageByIndex(0)const paragraph = page.getParagraphs()[0]const block = paragraph?.getBlocks()[0]if (paragraph && block) {  paragraph.setBlockText(block.id, 'Updated paragraph')}

Package: @univerjs-pro/pdfs · Type definitions

How is this guide?

© 2026 DreamNum Co., Ltd.