-
addImage(annotation)
-
Inserts a new image into the document using a placeholder.
Parameters:
Returns:
-
Type
-
Promise.<void>
-
addImage(pageNumber, rect, image [, options])
-
Inserts a new image into the document.
Parameters:
| Name |
Type |
Argument |
Description |
pageNumber |
number
|
|
The page number to insert the image on. |
rect |
Core.ContentEdit.BoundingBox
|
|
The bounding box in PDF coordinates defining position and size. |
image |
string
|
ArrayBuffer
|
|
The image data as a base64 data URL string or an ArrayBuffer. |
options |
Core.ContentEdit.AddImageOptions
|
<optional>
|
Optional image settings. |
Returns:
-
Type
-
Promise.<void>
-
addParagraph(annotation, content, isAddingHTMLContent)
-
Adds a new textbox to the document using a placeholder annotation.
Parameters:
| Name |
Type |
Description |
annotation |
Core.Annotations.Annotation
|
The annotation containing the data and properties to add |
content |
string
|
The text content to add |
isAddingHTMLContent |
boolean
|
If the text content to add is HTML |
Returns:
-
Type
-
Promise.<void>
-
addParagraph(pageNumber, rect, content [, options])
-
Adds a new textbox to the document.
Parameters:
| Name |
Type |
Argument |
Description |
pageNumber |
number
|
|
The page number to insert the paragraph on. |
rect |
Core.ContentEdit.BoundingBox
|
|
The bounding box in PDF coordinates defining position and size. |
content |
string
|
|
The text content to add. |
options |
Core.ContentEdit.AddParagraphOptions
|
<optional>
|
Optional font and content format settings. |
Returns:
-
Type
-
Promise.<void>
-
alignContents(contentEditPlaceholderAnnotation, alignment)
-
Aligns text content for a content edit placeholder.
When the content box is being edited, the alignment is applied to the current selection.
When not editing, the alignment is applied to the entire content box.
Parameters:
| Name |
Type |
Description |
contentEditPlaceholderAnnotation |
Core.Annotations.Annotation
|
The annotation that represents the content where alignment should be set. |
alignment |
'Left'
|
'Start'
|
'Center'
|
'End'
|
'Justify'
|
'JustifyAll'
|
'JustifyRight'
|
The paragraph alignment to apply. |
Returns:
A promise that resolves after alignment is applied.
-
Type
-
Promise.<void>
-
bringBackward( [contentBoxId])
-
Moves the content box with the given ID one step backward in the z-order on its page.
Falls back to the currently selected annotation's content box if no ID is provided.
Parameters:
| Name |
Type |
Argument |
Description |
contentBoxId |
string
|
<optional>
|
The ID of the content box to bring backward. |
Returns:
A promise that resolves when the command has been sent and the page regenerated.
-
Type
-
Promise.<void>
-
bringForward( [contentBoxId])
-
Moves the content box with the given ID one step forward in the z-order on its page.
Falls back to the currently selected annotation's content box if no ID is provided.
Parameters:
| Name |
Type |
Argument |
Description |
contentBoxId |
string
|
<optional>
|
The ID of the content box to bring forward. |
Returns:
A promise that resolves when the command has been sent and the page regenerated.
-
Type
-
Promise.<void>
-
calculateDefaultCursorPosition(contentBoxText)
-
Calculates the cursor index based on the current default cursor position.
Parameters:
Returns:
The index of the initial cursor position.
-
Type
-
number
-
endContentEditMode( [options])
-
Ends the Content Edit mode and removes content edit
boxes from the document.
Parameters:
Returns:
A promise that resolves when Content Edit mode is ended and the document is updated.
-
Type
-
Promise.<void>
-
getActiveEditingContentBox()
-
Gets the currently active content box being edited.
Returns:
The active content box, or null if none is active
-
Type
-
Core.ContentEdit.ContentBox
|
null
-
getContent(contentEditPlaceholderAnnotation)
-
Gets the content of a text content box in both XML string and span-object formats.
Parameters:
Returns:
The text content as XML and span objects.
-
Type
-
Promise.<Core.ContentEdit.TextDetails>
-
getContentBoxAttributes(contentBoxId)
-
Gets the text attributes applied to a content box.
Parameters:
| Name |
Type |
Description |
contentBoxId |
string
|
The ID of the content box. |
Returns:
The content box text attributes.
-
Type
-
Promise.<Core.ContentEdit.TextAttributes>
-
getContentBoxById(id)
-
Gets a content box instance by its ID.
Parameters:
| Name |
Type |
Description |
id |
string
|
The content box ID. |
Returns:
The content box, or undefined if it is not registered.
-
Type
-
Core.ContentEdit.ContentBox
|
undefined
-
getDefaultCursorPosition()
-
Gets the configured initial caret position for content-box editing.
Returns:
The initial caret position.
-
Type
-
'start'
|
'end'
-
getFontFamilyCatalog()
-
Retrieves the cached font catalog.
Returns:
The font catalog, or null if it has not been set.
-
Type
-
Array.<string>
|
null
-
hasActiveContentBoxEditor()
-
Returns if there is an active editor for a content box.
Returns:
True if there is an active editor, false otherwise.
-
Type
-
boolean
-
isContentBoxEditorActive(arg)
-
Check if the given content box or placeholder annotation is the active editing content box.
Parameters:
Returns:
True if the given content box or placeholder annotation is the active editing content box, false otherwise.
-
Type
-
boolean
-
isInContentEditMode()
-
Gets if the Content Edit manager is currently in content edit mode
Returns:
True if currently in content edit mode, false otherwise
-
Type
-
boolean
-
isReplacingText()
-
Gets whether a text replace operation is currently running.
This is true from the moment
replaceText begins
until it finishes, including when it fails. Use it to suppress work that should not run against
a document that is mid-replace, such as reacting to the content changes the replace itself causes.
Returns:
True if a replace is in progress, false otherwise
-
Type
-
boolean
-
isShowingInvisibleCharacters()
-
Returns whether invisible characters are currently included in content edit renders.
The value is manager-scoped and persists across content edit mode stop/start.
Returns:
True if invisible characters are shown.
-
Type
-
boolean
-
isToolAllowedInContentEditMode(toolName)
-
Returns whether or not a tool is allowed to be used in content edit mode.
Parameters:
| Name |
Type |
Description |
toolName |
string
|
The name of the tool to check. |
Returns:
Whether the tool is allowed in Content Edit mode.
-
Type
-
boolean
-
redo()
-
Reapplies the most recently undone Content Edit operation.
Returns:
A promise that resolves when the redo operation and its updates are complete.
-
Type
-
Promise.<void>
-
replaceText(searchResults, replacement [, options])
-
Replaces text based on search results. Get the search results from DocumentViewer.search()
and pass them to this method along with the replacement text. The method will handle replacing
the text in the document and updating the search results accordingly.
Parameters:
| Name |
Type |
Argument |
Description |
searchResults |
Array.<Core.Search.SearchResult>
|
|
Array of search results from DocumentViewer.search() |
replacement |
string
|
|
The replacement text |
options |
Core.ContentEdit.ReplaceOptions
|
<optional>
|
Optional replacement behavior.
Properties
| Name |
Type |
Argument |
Default |
Description |
caseSensitive |
boolean
|
<optional>
|
false
|
If true, match text case-sensitively. |
wholeWord |
boolean
|
<optional>
|
false
|
If true, match whole words only. |
resultIndexInPage |
number
|
<optional>
|
|
Precomputed page-local index for single-result replace. |
|
Returns:
A promise that resolves when the replacement operation is complete
-
Type
-
Promise.<void>
-
sendToBack( [contentBoxId])
-
Moves the content box with the given ID to the back of the z-order on its page.
Falls back to the currently selected annotation's content box if no ID is provided.
Parameters:
| Name |
Type |
Argument |
Description |
contentBoxId |
string
|
<optional>
|
The ID of the content box to send to the back. |
Returns:
A promise that resolves when the command has been sent and the page regenerated.
-
Type
-
Promise.<void>
-
sendToFront( [contentBoxId])
-
Moves the content box with the given ID to the front of the z-order on its page.
Falls back to the currently selected annotation's content box if no ID is provided.
Parameters:
| Name |
Type |
Argument |
Description |
contentBoxId |
string
|
<optional>
|
The ID of the content box to bring to the front. |
Returns:
A promise that resolves when the command has been sent and the page regenerated.
-
Type
-
Promise.<void>
-
setContent(contentEditPlaceholderAnnotation, content [, isInheritingContentBoxStyles])
-
Sets the content of a text content box using an XML string or span objects.
Parameters:
| Name |
Type |
Argument |
Default |
Description |
contentEditPlaceholderAnnotation |
Core.Annotations.Annotation
|
|
|
The content edit placeholder annotation. |
content |
string
|
Array.<Core.ContentEdit.SpanObject>
|
|
|
New content to apply. |
isInheritingContentBoxStyles |
boolean
|
<optional>
|
true
|
Whether to preserve content-box base styles. |
Returns:
A promise that resolves after the content is updated.
-
Type
-
Promise.<void>
-
setContentBoxAttributes(attributes, contentBox)
-
Sets the text attributes applied to the content edit box.
Parameters:
-
setDefaultCursorPosition(cursorPosition)
-
Sets whether the initial caret is placed at the start or end of a content box.
Parameters:
| Name |
Type |
Description |
cursorPosition |
'start'
|
'end'
|
The initial caret position. |
-
setTextColor(contentEditPlaceholderAnnotation, color)
-
Sets text color for a content edit placeholder.
When the content box is being edited, the color is applied to the current selection or caret position.
When not editing, the color is applied to the entire content box.
Parameters:
| Name |
Type |
Description |
contentEditPlaceholderAnnotation |
Core.Annotations.Annotation
|
The annotation that represents the content where text color should be set. |
color |
string
|
The hex color to apply. |
Returns:
A promise that resolves after the color is applied.
-
Type
-
Promise.<void>
-
startContentEditMode()
-
Starts the Content Edit mode, a mode in which links are disabled
and boxes are drawn around all editable content so users can edit them.
Returns:
A promise that resolves when Content Edit mode is started.
-
Type
-
Promise.<void>
-
startEditingContentBox(target)
-
Starts editing a content box by annotation or a content box ID.
Parameters:
| Name |
Type |
Description |
target |
Core.Annotations.Annotation
|
string
|
The content edit placeholder or content box ID string identifying the box to edit. |
Returns:
A promise that resolves when the content box has been rendered and the edit session is ready.
-
Type
-
Promise.<void>
Examples
// Edit by annotation
await contentEditManager.startEditingContentBox(annotation);
// Edit by content box ID string
await contentEditManager.startEditingContentBox('content-box-123');
-
stopEditingContentBox(target)
-
Stops the active editing session for a text content box.
Parameters:
Returns:
A promise that resolves when editing stops.
-
Type
-
Promise.<void>
-
toggleBoldContents(contentEditPlaceholderAnnotation)
-
Bold or unbold text content (v4).
Parameters:
| Name |
Type |
Description |
contentEditPlaceholderAnnotation |
Core.Annotations.Annotation
|
The annotation that represents the content where bold should be toggled |
Returns:
A promise that resolves after the content has been updated
-
Type
-
Promise.<void>
-
toggleInvisibleCharacters()
-
Toggles the visibility of invisible characters in the content edit boxes.
-
toggleItalicContents(contentEditPlaceholderAnnotation)
-
Italicize or unitalicize text content (v4).
Parameters:
| Name |
Type |
Description |
contentEditPlaceholderAnnotation |
Core.Annotations.Annotation
|
The annotation that represents the content where italics should be toggled |
Returns:
A promise that resolves after the content has been updated
-
Type
-
Promise.<void>
-
toggleStrikeContents(contentEditPlaceholderAnnotation)
-
Strike or de-strike text content (v4).
Parameters:
| Name |
Type |
Description |
contentEditPlaceholderAnnotation |
Core.Annotations.Annotation
|
The annotation that represents the content where strike should be toggled |
Returns:
A promise that resolves after the content has been updated
-
Type
-
Promise.<void>
-
toggleUnderlineContents(contentEditPlaceholderAnnotation)
-
Underline or de-underline text content (v4).
Parameters:
| Name |
Type |
Description |
contentEditPlaceholderAnnotation |
Core.Annotations.Annotation
|
The annotation that represents the content where underline should be toggled |
Returns:
A promise that resolves after the content has been updated
-
Type
-
Promise.<void>
-
undo()
-
Undoes the most recent Content Edit operation.
Returns:
A promise that resolves when the undo operation and its updates are complete.
-
Type
-
Promise.<void>