The namespace for APIs dealing with document content editing
Extends
Classes
Members
-
<static> Events
-
- Deprecated:
-
- Use the new ContentEditManager API events instead.
Properties:
Name Type Description TEXT_CONTENT_UPDATEDstring Core.ContentEdit.textContentUpdated SEARCH_AND_REPLACE_STARTEDstring Core.ContentEdit.searchAndReplaceStarted SEARCH_AND_REPLACE_TEXT_REPLACEDstring Core.ContentEdit.searchAndReplaceTextReplaced SEARCH_AND_REPLACE_TEXT_FOUNDstring Core.ContentEdit.searchAndReplaceTextFound SEARCH_AND_REPLACE_ENDEDstring Core.ContentEdit.searchAndReplaceEnded EDIT_BOXES_AVAILABLEstring Core.ContentEdit.editBoxesAvailable UNDO_REDO_STATUS_CHANGEDstring Core.ContentEdit.undoRedoStatusChanged -
<static> Types
-
Content Edit types.
Properties:
Name Type Description TEXTstring Text type content. OBJECTstring Object type content, currently image only.
Methods
-
<static> addNewParagraph(content [, options])
-
Adds a new text box to the document.
Parameters:
Name Type Argument Description contentstring The actual text content to be added to the paragraph. optionsCore.ContentEdit.AddNewParagraphOptions <optional>
Paragraph placement and styling options. - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves when the content is added.- Type
- Promise.<void>
-
<static> alignContents(contentEditPlaceholderAnnotation, alignment)
-
Align text content
Parameters:
Name Type Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The annotation that represents the content where the text alignment should be set alignment'Left' | 'Start' | 'Center' | 'End' | 'Justify' | 'JustifyAll' | 'JustifyRight' The paragraph alignment to apply. - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves after the content has been updated- Type
- Promise.<void>
-
<static> getContent(contentEditPlaceholderAnnotation)
-
Gets the content of a text content box.
Parameters:
Name Type Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The target content edit placeholder annotation. - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves to text details.- Type
- Promise.<Core.ContentEdit.TextDetails>
-
<static> getContentEditingFonts()
-
Get a list of fonts available for content editing
- Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
The available font names, or null if the font catalog has not been loaded.- Type
- Array.<string> | null
-
<static> getDocumentContent(contentEditPlaceholderAnnotation)
-
Gets the content of a text content box.
Parameters:
Name Type Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The target content-edit placeholder annotation. - Deprecated:
-
- Use Core.ContentEditManager#getContent instead.
Returns:
A promise that resolves to text details.- Type
- Promise.<Core.ContentEdit.TextDetails>
-
<static> getLongTextReflow()
-
Gets whether long-text reflow is enabled. The current implementation always returns true.
- Deprecated:
-
- This API will be removed in future releases.
Returns:
A promise that resolves to true.- Type
- Promise.<boolean>
-
<static> getResourcePath()
-
Gets the configured global worker path for backward compatibility.
- Deprecated:
-
- This API will be removed in version 13. use Core.getWorkerPath to configure worker file locations.
Returns:
The global worker path, or an empty string if unavailable.- Type
- string
-
<static> getWorkerPath()
-
Gets the configured global worker path for backward compatibility.
- Deprecated:
-
- This API will be removed in version 13. use Core.getWorkerPath to configure worker file locations.
Returns:
The global worker path, or an empty string if unavailable.- Type
- string
-
<static> loadTextAttributes(id, startIndex, selectionLength [, restrictOptions])
-
Legacy no-op retained for compatibility. Text attributes are returned with worker results and cached on content boxes.
Parameters:
Name Type Argument Description idstring The content-box ID. startIndexnumber The index where the change starts selectionLengthnumber The length from start index to end index of the selected text restrictOptionsCore.ContentEdit.RestrictOptions <optional>
Legacy options that have no effect in the current implementation. - Deprecated:
-
- This API will be removed in future releases.
Returns:
A promise that resolves after argument validation.- Type
- Promise.<void>
-
<static> preloadWorker(contentEditManager)
-
Preloads the content-edit environment for a document viewer's content-edit manager. Applies the styles required for content editing. Repeated calls for the same manager have no additional effect.
Parameters:
Name Type Description contentEditManagerCore.ContentEditManager The ContentEditManager instance to preload. -
<static> regeneratePage()
-
Sends a command to the worker to regenerate the content boxes and page content.
- Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves after the currently edited page is regenerated.- Type
- Promise.<void>
-
<static> searchAndReplaceText(options)
-
A function that will search and replace text inside the document.
Parameters:
Name Type Description optionsCore.ContentEdit.SearchReplaceOptions Search results, replacement text, and matching options. Returns:
A promise that resolves when the operation completes.- Type
- Promise.<void>
Example
instance.Core.ContentEdit.searchAndReplaceText({ replaceWith: 'DOCX', searchResults: instance.Core.documentViewer.getPageSearchResults([1]) }); -
<static> setContent(contentEditPlaceholderAnnotation, content [, isInheritingContentBoxStyles])
-
Sets the content of a text content box.
Parameters:
Name Type Argument Default Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The target content edit placeholder annotation. contentstring | Array.<Core.ContentEdit.SpanObject> Content to apply. isInheritingContentBoxStylesboolean <optional>
true Whether to preserve content box styles. - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves after the content has been updated.- Type
- Promise.<void>
-
<static> setContentEditManager(contentEditManager)
-
Sets the manager instance used by the legacy ContentEdit APIs.
Parameters:
Name Type Description contentEditManagerCore.ContentEditManager The ContentEditManager instance to use. -
<static> setContentFont(contentEditPlaceholderAnnotation, font)
-
Set font of text content
Parameters:
Name Type Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The annotation that represents the content where the font should be set fontstring The font family to set - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves after the content has been updated- Type
- Promise.<void>
-
<static> setContentFontSize(contentEditPlaceholderAnnotation, size)
-
Set font size of text content
Parameters:
Name Type Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The annotation that represents the content where font size should be set sizestring The font size to set - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves after the content has been updated- Type
- Promise.<void>
-
<static> setLongTextReflow(contentEditManagerOrTextReflow [, textReflow])
-
Retained for compatibility; the current implementation always enables long-text reflow.
Parameters:
Name Type Argument Description contentEditManagerOrTextReflowCore.ContentEditManager | boolean The reflow flag, or a legacy ContentEditManager argument. textReflowboolean <optional>
The reflow flag when the legacy two-argument signature is used. - Deprecated:
-
- This API will be removed in future releases.
Returns:
A promise that resolves after the compatibility call completes.- Type
- Promise.<void>
-
<static> setResourcePath()
-
Retained for compatibility; setting a ContentEdit-specific resource path is no longer supported.
- Deprecated:
-
- This API will be removed in version 13. This API no longer does anything. use Core.setWorkerPath to configure worker file locations.
-
<static> setTextAttributes(textProperties)
-
Sets the active text attributes to be applied to new text
Parameters:
Name Type Description textPropertiesCore.ContentEdit.TextAttributes The text properties to apply to new text - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
-
<static> setTextColor(contentEditPlaceholderAnnotation, color)
-
Set font color of text content
Parameters:
Name Type Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The annotation that represents the content where the text color should be set colorstring The color of the text to set - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves after the content has been updated- Type
- Promise.<void>
-
<static> setWorkerPath()
-
Retained for compatibility; setting a ContentEdit-specific worker path is no longer supported.
- Deprecated:
-
- This API will be removed in version 13. This API no longer does anything. use Core.setWorkerPath to configure worker file locations.
-
<static> toggleBoldContents(contentEditPlaceholderAnnotation)
-
Bold or unbold text content
Parameters:
Name Type Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The annotation that represents the content where bold should be toggled - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves after the content has been updated- Type
- Promise.<void>
-
<static> toggleItalicContents(contentEditPlaceholderAnnotation)
-
Italicize or unitalicize text content
Parameters:
Name Type Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The annotation that represents the content where italics should be toggled - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves after the content has been updated- Type
- Promise.<void>
-
<static> toggleStrikeContents(contentEditPlaceholderAnnotation)
-
Strike or de-strike text content
Parameters:
Name Type Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The annotation that represents the content where strike should be toggled - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves after the content has been updated- Type
- Promise.<void>
-
<static> toggleUnderlineContents(contentEditPlaceholderAnnotation)
-
Underline or de-underline text content
Parameters:
Name Type Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The annotation that represents the content where underline should be toggled - Deprecated:
-
- This API will be moved to the ContentEditManager instance in future releases.
Returns:
A promise that resolves after the content has been updated- Type
- Promise.<void>
-
<static> updateDocumentContent(contentEditPlaceholderAnnotation, content [, isInheritingContentBoxStyles])
-
Updates the content of a text content box.
Parameters:
Name Type Argument Default Description contentEditPlaceholderAnnotationCore.Annotations.Annotation The target content-edit placeholder annotation. contentstring | Array.<Core.ContentEdit.SpanObject> Content to apply. isInheritingContentBoxStylesboolean <optional>
true Whether to preserve content-box styles. - Deprecated:
-
- Use Core.ContentEditManager#setContent instead.
Returns:
A promise that resolves after the content has been updated.- Type
- Promise.<void>
Type Definitions
-
AddImageOptions
-
Options for the page-number-based `addImage` overload.
Properties:
Name Type Argument Description rotationnumber <optional>
Image rotation in degrees (must be a multiple of 90). -
AddParagraphOptions
-
Options for the page-number-based `addParagraph` overload.
Properties:
Name Type Argument Description fontstring <optional>
The font family for the new paragraph (default: 'Arimo'). fontSizenumber <optional>
The font size for the new paragraph (default: 14). fontColorstring <optional>
The font color for the new paragraph, as an RGB string, e.g. `'rgb(0, 0, 0)'` (default: 'rgb(0, 0, 0)'). isAddingHTMLContentboolean <optional>
Whether the content is HTML (default: true). -
BoundingBox
-
A bounding box in PDF coordinates with required left, top, right, and bottom edges.
Properties:
Name Type Description leftnumber The left edge (x-coordinate). topnumber The top edge (y-coordinate). rightnumber The right edge (x-coordinate). bottomnumber The bottom edge (y-coordinate). -
ContentBoxEditor
-
Deprecated alias for ContentEditSession. Use ContentEditSession instead.
Type:
- ContentEditSession
- Deprecated:
-
- Use Core.ContentEdit.ContentEditSession instead.
-
ObjectBox
-
Object-box data returned by ContentBox.getBoxData.
Type:
- object
Properties:
Name Type Description oidstring The PDF object ID. pageNumbernumber The page number containing the object. typestring The PDF object type, such as Image. galleyBoundingBoxCore.ContentEdit.BoundingBox The object bounds in PDF coordinates. -
Quad
-
The four corner points describing content-box geometry.
Type:
- object
Properties:
Name Type Description topLeftCore.ContentEdit.QuadPoint The top-left corner. topRightCore.ContentEdit.QuadPoint The top-right corner. bottomLeftCore.ContentEdit.QuadPoint The bottom-left corner. bottomRightCore.ContentEdit.QuadPoint The bottom-right corner. -
QuadPoint
-
A point in a content-edit quadrilateral.
Type:
- object
Properties:
Name Type Description xnumber The horizontal coordinate. ynumber The vertical coordinate. -
RestrictOptions
-
Legacy options accepted by loadTextAttributes. These flags have no effect in the current implementation.
Type:
- object
Properties:
Name Type Argument Description restrictFontNameboolean <optional>
Legacy option; has no effect. restrictFontSizeboolean <optional>
Legacy option; has no effect. -
SpanObject
-
Represents a segment of text with associated formatting metadata. Each span object corresponds to a contiguous range of text with the same formatting.
Properties:
Name Type Argument Description textstring The actual text content of the span. paragraphIndexnumber The index of the paragraph this span belongs to. fontFamilystring <optional>
The font family of the text (optional). fontWeightstring <optional>
The font weight of the text (optional). fontSizestring <optional>
The font size of the text (optional). fontStylestring <optional>
The font style of the text (optional). colorstring <optional>
The color of the text (optional). alignstring <optional>
The alignment of the text (optional). leadingModestring <optional>
The leading mode of the text (optional). startIndentstring <optional>
The starting indentation of the text (optional). underlineStartnumber <optional>
The starting index for underlining (optional). underlineEndnumber <optional>
The ending index for underlining (optional). -
TextAttributes
-
TextAttributes types.
Properties:
Name Type Description boldStylesArray.<{bold: boolean, characterCount: number}> Bold values and their character counts. boldStyles[].boldboolean Bold style value. boldStyles[].characterCountnumber Character count for the bold style. fontColorsArray.<{fontColor: string, characterCount: number, colorIndex: number}> Font colors, character counts, and color indices. fontColors[].fontColorstring Font color value. fontColors[].characterCountnumber Character count for the font color. fontColors[].colorIndexnumber Color index value. fontNamesArray.<{fontName: string, characterCount: number}> Font names and their character counts. fontNames[].fontNamestring Font name value. fontNames[].characterCountnumber Character count for the font name. fontSizesArray.<{fontSize: string, characterCount: number}> Font sizes and their character counts. fontSizes[].fontSizestring Font size value. fontSizes[].characterCountnumber Character count for the font size. italicStylesArray.<{italic: boolean, characterCount: number}> Italic values and their character counts. italicStyles[].italicboolean Italic style value. italicStyles[].characterCountnumber Character count for the italic style. underlineStylesArray.<{underline: boolean, characterCount: number}> Underline values and their character counts. underlineStyles[].underlineboolean Underline style value. underlineStyles[].characterCountnumber Character count for the underline style. leadingsArray.<{leading: number}> Leading values. leadings[].leadingnumber Leading value. textAlignsArray.<{textAlign: string}> Text alignments. textAligns[].textAlignstring Text alignment value. boldboolean Indicates whether the text is bold. fontColorstring The color of the font. fontNamestring The name of the font. fontSizestring The size of the font. italicboolean Indicates whether the text is italicized. leadingnumber The leading (line spacing) value. textAlignstring The text alignment (e.g., left, right, center). underlineboolean Indicates whether the text is underlined. strikeboolean Indicates whether the text has a strikethrough. valignstring The vertical alignment of the text. autofitboolean Indicates whether the text should automatically fit within its container. -
TextBox
-
Text-box data returned by ContentBox.getBoxData.
Type:
- object
Properties:
Name Type Description oidstring The PDF object ID. idstring The content-box ID, or an empty string when unavailable. pageNumbernumber The page number containing the text box. contentsstring | null The text content, or null when it has not been loaded. quadCore.ContentEdit.Quad | null The text-box geometry, or null when unavailable. anglenumber The text-box rotation in degrees. textLinesArray.<Core.ContentEdit.TextLineData> The text-line layout data. oversetboolean Whether the text exceeds the available box area. numberOfLinesnumber The number of text lines. -
TextCharacter
-
Character and geometry data for one character in a content-edit text line.
Type:
- object
Properties:
Name Type Argument Description characterstring The character value. quadCore.ContentEdit.Quad The character bounds in PDF coordinates. characterXOffsetInLinenumber <optional>
The character's horizontal offset in its line. characterWidthnumber <optional>
The character width in PDF coordinates. characterHeightnumber <optional>
The character height in PDF coordinates. -
TextDetails
-
Represents text content in XML and span-object formats.
Properties:
Name Type Description xmlStringstring The XML representation of the text content. spanObjectsArray.<Core.ContentEdit.SpanObject> An array of SpanObject instances representing the text content. -
TextLineData
-
Text-line layout and character data for a content-edit text box.
Type:
- object
Properties:
Name Type Argument Description lineIndexnumber The zero-based line index. charsArray.<Core.ContentEdit.TextCharacter> The characters in the line. refreshboolean Whether the line should be refreshed. lineYOffsetFromFirstLinenumber <optional>
The vertical offset from the first line. lineHeightnumber <optional>
The line height. textBoxQuadHeightnumber <optional>
The text-box height in PDF coordinates. textBoxQuadWidthnumber <optional>
The text-box width in PDF coordinates.
Events
-
editBoxesAvailable
-
Triggered when editable content boxes have been loaded for a page.
Parameters:
Name Type Description contentBoxesArray.<(Core.ContentEdit.TextBox|Core.ContentEdit.ObjectBox)> The loaded text and object content-box data for the page. -
searchAndReplaceEnded
-
Triggered when a search-and-replace operation finishes, whether or not any text was replaced.
-
searchAndReplaceStarted
-
Triggered when a search-and-replace operation starts.
-
searchAndReplaceTextFound
-
Triggered when a search-and-replace operation finds matches.
Parameters:
Name Type Description searchResultsArray.<Core.Search.SearchResult> The search results found by the operation. -
searchAndReplaceTextReplaced
-
Triggered when a search-and-replace operation replaces at least one match.
-
textContentUpdated
-
Triggered when the text content of a content box changes.
Parameters:
Name Type Description oldContentstring The content before the update. newContentstring The content after the update. coordsCore.Math.Rect The content box bounds in viewer coordinates. -
undoRedoStatusChanged
-
Triggered when the available undo or redo state changes.