Namespace: ContentEdit

Core. ContentEdit

The namespace for APIs dealing with document content editing

Extends

Classes

ContentBox
ContentEditSession

Members


<static> Events

Properties:
Name Type Description
TEXT_CONTENT_UPDATED string Core.ContentEdit.textContentUpdated
SEARCH_AND_REPLACE_STARTED string Core.ContentEdit.searchAndReplaceStarted
SEARCH_AND_REPLACE_TEXT_REPLACED string Core.ContentEdit.searchAndReplaceTextReplaced
SEARCH_AND_REPLACE_TEXT_FOUND string Core.ContentEdit.searchAndReplaceTextFound
SEARCH_AND_REPLACE_ENDED string Core.ContentEdit.searchAndReplaceEnded
EDIT_BOXES_AVAILABLE string Core.ContentEdit.editBoxesAvailable
UNDO_REDO_STATUS_CHANGED string Core.ContentEdit.undoRedoStatusChanged
Deprecated:
  • Use the new ContentEditManager API events instead.

<static> Types

Content Edit types.
Properties:
Name Type Description
TEXT string Text type content.
OBJECT string Object type content, currently image only.

Methods


<static> addNewParagraph(content [, options])

Adds a new text box to the document.
Parameters:
Name Type Argument Description
content string The actual text content to be added to the paragraph.
options Core.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
contentEditPlaceholderAnnotation Core.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
contentEditPlaceholderAnnotation Core.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
contentEditPlaceholderAnnotation Core.Annotations.Annotation The target content-edit placeholder annotation.
Deprecated:
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
id string The content-box ID.
startIndex number The index where the change starts
selectionLength number The length from start index to end index of the selected text
restrictOptions Core.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
contentEditManager Core.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
options Core.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
contentEditPlaceholderAnnotation Core.Annotations.Annotation The target content edit placeholder annotation.
content string | Array.<Core.ContentEdit.SpanObject> Content to apply.
isInheritingContentBoxStyles boolean <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
contentEditManager Core.ContentEditManager The ContentEditManager instance to use.

<static> setContentFont(contentEditPlaceholderAnnotation, font)

Set font of text content
Parameters:
Name Type Description
contentEditPlaceholderAnnotation Core.Annotations.Annotation The annotation that represents the content where the font should be set
font string 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
contentEditPlaceholderAnnotation Core.Annotations.Annotation The annotation that represents the content where font size should be set
size string 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
contentEditManagerOrTextReflow Core.ContentEditManager | boolean The reflow flag, or a legacy ContentEditManager argument.
textReflow boolean <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
textProperties Core.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
contentEditPlaceholderAnnotation Core.Annotations.Annotation The annotation that represents the content where the text color should be set
color string 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
contentEditPlaceholderAnnotation Core.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
contentEditPlaceholderAnnotation Core.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
contentEditPlaceholderAnnotation Core.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
contentEditPlaceholderAnnotation Core.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
contentEditPlaceholderAnnotation Core.Annotations.Annotation The target content-edit placeholder annotation.
content string | Array.<Core.ContentEdit.SpanObject> Content to apply.
isInheritingContentBoxStyles boolean <optional>
true Whether to preserve content-box styles.
Deprecated:
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
rotation number <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
font string <optional>
The font family for the new paragraph (default: 'Arimo').
fontSize number <optional>
The font size for the new paragraph (default: 14).
fontColor string <optional>
The font color for the new paragraph, as an RGB string, e.g. `'rgb(0, 0, 0)'` (default: 'rgb(0, 0, 0)').
isAddingHTMLContent boolean <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
left number The left edge (x-coordinate).
top number The top edge (y-coordinate).
right number The right edge (x-coordinate).
bottom number 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
oid string The PDF object ID.
pageNumber number The page number containing the object.
type string The PDF object type, such as Image.
galleyBoundingBox Core.ContentEdit.BoundingBox The object bounds in PDF coordinates.

Quad

The four corner points describing content-box geometry.
Type:
  • object
Properties:
Name Type Description
topLeft Core.ContentEdit.QuadPoint The top-left corner.
topRight Core.ContentEdit.QuadPoint The top-right corner.
bottomLeft Core.ContentEdit.QuadPoint The bottom-left corner.
bottomRight Core.ContentEdit.QuadPoint The bottom-right corner.

QuadPoint

A point in a content-edit quadrilateral.
Type:
  • object
Properties:
Name Type Description
x number The horizontal coordinate.
y number 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
restrictFontName boolean <optional>
Legacy option; has no effect.
restrictFontSize boolean <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
text string The actual text content of the span.
paragraphIndex number The index of the paragraph this span belongs to.
fontFamily string <optional>
The font family of the text (optional).
fontWeight string <optional>
The font weight of the text (optional).
fontSize string <optional>
The font size of the text (optional).
fontStyle string <optional>
The font style of the text (optional).
color string <optional>
The color of the text (optional).
align string <optional>
The alignment of the text (optional).
leadingMode string <optional>
The leading mode of the text (optional).
startIndent string <optional>
The starting indentation of the text (optional).
underlineStart number <optional>
The starting index for underlining (optional).
underlineEnd number <optional>
The ending index for underlining (optional).

TextAttributes

TextAttributes types.
Properties:
Name Type Description
boldStyles Array.<{bold: boolean, characterCount: number}> Bold values and their character counts.
boldStyles[].bold boolean Bold style value.
boldStyles[].characterCount number Character count for the bold style.
fontColors Array.<{fontColor: string, characterCount: number, colorIndex: number}> Font colors, character counts, and color indices.
fontColors[].fontColor string Font color value.
fontColors[].characterCount number Character count for the font color.
fontColors[].colorIndex number Color index value.
fontNames Array.<{fontName: string, characterCount: number}> Font names and their character counts.
fontNames[].fontName string Font name value.
fontNames[].characterCount number Character count for the font name.
fontSizes Array.<{fontSize: string, characterCount: number}> Font sizes and their character counts.
fontSizes[].fontSize string Font size value.
fontSizes[].characterCount number Character count for the font size.
italicStyles Array.<{italic: boolean, characterCount: number}> Italic values and their character counts.
italicStyles[].italic boolean Italic style value.
italicStyles[].characterCount number Character count for the italic style.
underlineStyles Array.<{underline: boolean, characterCount: number}> Underline values and their character counts.
underlineStyles[].underline boolean Underline style value.
underlineStyles[].characterCount number Character count for the underline style.
leadings Array.<{leading: number}> Leading values.
leadings[].leading number Leading value.
textAligns Array.<{textAlign: string}> Text alignments.
textAligns[].textAlign string Text alignment value.
bold boolean Indicates whether the text is bold.
fontColor string The color of the font.
fontName string The name of the font.
fontSize string The size of the font.
italic boolean Indicates whether the text is italicized.
leading number The leading (line spacing) value.
textAlign string The text alignment (e.g., left, right, center).
underline boolean Indicates whether the text is underlined.
strike boolean Indicates whether the text has a strikethrough.
valign string The vertical alignment of the text.
autofit boolean Indicates whether the text should automatically fit within its container.

TextBox

Text-box data returned by ContentBox.getBoxData.
Type:
  • object
Properties:
Name Type Description
oid string The PDF object ID.
id string The content-box ID, or an empty string when unavailable.
pageNumber number The page number containing the text box.
contents string | null The text content, or null when it has not been loaded.
quad Core.ContentEdit.Quad | null The text-box geometry, or null when unavailable.
angle number The text-box rotation in degrees.
textLines Array.<Core.ContentEdit.TextLineData> The text-line layout data.
overset boolean Whether the text exceeds the available box area.
numberOfLines number 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
character string The character value.
quad Core.ContentEdit.Quad The character bounds in PDF coordinates.
characterXOffsetInLine number <optional>
The character's horizontal offset in its line.
characterWidth number <optional>
The character width in PDF coordinates.
characterHeight number <optional>
The character height in PDF coordinates.

TextDetails

Represents text content in XML and span-object formats.
Properties:
Name Type Description
xmlString string The XML representation of the text content.
spanObjects Array.<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
lineIndex number The zero-based line index.
chars Array.<Core.ContentEdit.TextCharacter> The characters in the line.
refresh boolean Whether the line should be refreshed.
lineYOffsetFromFirstLine number <optional>
The vertical offset from the first line.
lineHeight number <optional>
The line height.
textBoxQuadHeight number <optional>
The text-box height in PDF coordinates.
textBoxQuadWidth number <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
contentBoxes Array.<(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
searchResults Array.<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
oldContent string The content before the update.
newContent string The content after the update.
coords Core.Math.Rect The content box bounds in viewer coordinates.

undoRedoStatusChanged

Triggered when the available undo or redo state changes.