Web SDKv1.0.0

EditTextToolApi.listBlocks()

The editable text blocks on a page, as EditableTextBlock[]. Each block's text is '' under a license without extract.
methodReadingsince 1.0.0

Signature

listBlocks(pageIndex: number): Promise<EditableTextBlock[]>

Parameters

ParameterTypeDescription
pageIndexnumberZero-based page index.

Returns

Promise<EditableTextBlock[]> Each { id, pageIndex, text, bounds, fontFamily, fontSize, fontWeight, isItalic, fillColor, opacity }; id is stable within one detection pass, text includes an uncommitted edit, bounds is a Rect in page space.

Throws

  • INVALID_STATE while the tool is not active — without edit-text it cannot be activated.
  • INVALID_ARGUMENT for a page index the document has not.
  • PAGE_ERROR when the page could not be loaded.

Example

TypeScript
const blocks = await viewer.tools.editText.listBlocks(0);

More in EditTextToolApi