This topic describes the API operations that are related to the ActivePDF object of PDF documents.
ActivePDF
Obtains the current PDF document.
Syntax
expression.ActivePDFexpression: an Application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the active PDF document. const ActivePDF = await app.ActivePDF; }
Methods
ActivePDF.GetOperatorsInfo()
Obtains information about current operators of the PDF document.
Syntax
expression.ActivePDF.GetOperatorsInfo()expression: an Application object.
Return values
Object object
Parameter
Type
Description
type
String
The request type.
response
Object
User information.
Response structure
Parameter
Type
Description
id
String
The ID of the user.
avatar_url
String
The profile picture of the user.
logined
String
The logon status of the user.
name
String
The name of the user.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain operator information. const operatorsInfo = await app.ActivePDF.GetOperatorsInfo(); console.log(operatorsInfo); }
ActivePDF.JumpToPage()
Jumps to the specified page.
Syntax
expression.ActivePDF.JumpToPage(PageNum)expression: an Application object.
Parameters
Parameter
Type
Required
Description
PageNum
Number
Yes
The page number to jump to.
Example
async function example() { await instance.ready(); const app = instance.Application; // Jump to the specified page. await app.ActivePDF.JumpToPage(3); }
ActivePDF.ExportAsFixedFormat()
Exports the active PDF document as an image.
Syntax
expression.ActivePDF.ExportAsFixedFormat({ FixedFormatType })expression: an Application object.
Parameters
Parameter
Type
Required
Description
FixedFormatType
Enum
No
The format of the exported file. Only image is supported. For more information, see FixedFormatType.
Print
Boolean
No
Specifies whether to open the exported file. Valid values:
false (default)
true
ImgFormat
Enum
No
The format of the exported image. For more information, see ExportImgFormatType.
Dpi
Number
No
The resolution of the image. Unit: ppi. Valid values: 96 to 2048. Default value: 96.
Combine2LongPic
Boolean
No
Specifies whether to export the document as a long image. Valid values:
false (default)
true
RangeType
Enum
No
The range to export. For more information, see RangeType.
WaterMark
Boolean
No
Specifies whether to add watermarks to the exported file. Valid values:
false (default)
true
From
Boolean
No
The start page of the range to export. The default value is the current page number.
To
Boolean
No
The end page of the range to export. The default value is the current page number.
Return values
The URL of the exported file.
Example
async function example() { await instance.ready(); const app = instance.Application; // Export the active PDF document as an image. const imgUrl = await app.ActivePDF.ExportAsFixedFormat({ FixedFormatType: app.Enum.FixedFormatType.TypeIMG, }); console.log(imgUrl); }
ActivePDF.Save()
Saves changes to the document.
Only JS-SDK V1.1.10 and later support this feature.
Syntax
expression.ActivePDF.Save()expression: an Application object.
Return values
Parameter
Type
Description
result
String
The status of the save operation.
size
Number
The size of the file. Unit: byte.
version
Number
The version number.
Description of save status
Status
Description
ok
The version is saved. You can view the version in Version History.
nochange
No changes are made to the document. You do not need to save this version.
SavedEmptyFile
You cannot save an empty file. This status is returned when the document is empty after the kernel is saved.
SpaceFull
The disk space is full.
QueneFull
We recommend that you do not perform frequent saving operations when the document is being saved. This status is returned when the saving operation queue is full on the server.
fail
The document version failed to be saved.
Example
async function example() { await instance.ready(); const app = instance.Application; // Save changes to the document. const saveResult = await app.ActivePDF.Save(); console.log(saveResult); }
ActivePDF.SetOpenMarkerInkEdit()
Enables the marker, or saves and exits the marker.
Only JS-SDK V1.1.10 and later support this feature.
Syntax
expression.ActivePDF.SetOpenMarkerInkEdit({ Open })expression: an Application object.
Parameters
Parameter
Type
Required
Description
Open
Boolean
No
Specifies whether to enable the marker or save and exit the marker. Valid values:
true: enables the marker. This is the default value.
false: saves and exits the marker.
Example
async function example() { await instance.ready(); const app = instance.Application; // Enable the marker. await app.ActivePDF.SetOpenMarkerInkEdit(true); setTimeout(async () => { // Save and exit the marker in 5,000 ms. await app.ActivePDF.SetOpenMarkerInkEdit(false); }, 5000); }
ActivePDF.ScrollTo()
Scrolls the document to the specified position.
Only JS-SDK V1.1.10 and later support this feature.
Syntax
expression.ActivePDF.ScrollTo(x, y)expression: an Application object.
Parameters
Parameter
Type
Required
Description
x
Number
No
The x-coordinate of the position to scroll to.
y
Number
No
The y-coordinate of the position to scroll to.
Example
async function example() { await instance.ready(); const app = instance.Application; // Specify a position to scroll to. await app.ActivePDF.ScrollTo(100, 100); }
ActivePDF.StartPlay()
Sets the play mode.
Only JS-SDK V1.1.10 and later support this feature.
Syntax
expression.ActivePDF.StartPlay(type, DisFullscreen, HiddenMenu)expression: an Application object.
Parameters
Parameter
Type
Required
Description
Type
String
No
The play mode. Valid values:
start: plays from the first page.
active: plays from the current page. This is the default value.
DisFullscreen
Boolean
No
Specifies whether to play in full-screen mode. Valid values:
false (default)
true
HiddenMenu
Boolean
No
Specifies whether to hide the menu. Valid values:
false (default)
true
Example
async function example() { await instance.ready(); const app = instance.Application; // Set the play mode. await app.ActivePDF.StartPlay("active", true, true); }
ActivePDF.EndPlay()
Exits the play mode.
Only JS-SDK V1.1.10 and later support this feature.
Syntax
expression.ActivePDF.EndPlay()expression: an Application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Exit the play mode. await app.ActivePDF.EndPlay(); }
ActivePDF.GetSelectionPicture()
Obtains the selected image.
Only JS-SDK V1.1.11 and later support this feature.
Syntax
expression.ActivePDF.GetSelectionPicture()expression: an Application object.
Return values
Parameter
Type
Description
result
String
The URL of the image.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the selected image. await app.ActivePDF.GetSelectionPicture(); }
ActivePDF.GetPageRenderPicture()
Converts the specified page into an image.
Only JS-SDK V1.1.11 and later support this feature.
Syntax
expression.ActivePDF.GetPageRenderPicture()expression: an Application object.
Return values
Parameter
Type
Description
result
String
The URL of the image.
Example
async function example() { await instance.ready(); const app = instance.Application; // Convert the specified page into an image. await app.ActivePDF.GetPageRenderPicture(); }
ActivePDF.GetMenuPageIndex()
Obtains the page where the right-click menu is located.
Only JS-SDK V1.1.11 and later support this feature.
Syntax
expression.ActivePDF.GetMenuPageIndex()expression: an Application object.
Return values
Parameter
Type
Description
result
Number
The page number.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the page where the right-click menu is located. await app.ActivePDF.GetMenuPageIndex(); }
ActivePDF.PageTextData()
Obtains the text data in the specified page.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.PageTextData(PageIndex)expression: an Application object.
Parameters
Parameter
Type
Required
Description
PageIndex
Number
Yes
The page number.
Return values
Parameter
Type
Description
result
Array
The text data object.
pg: the page number.
content: the text data.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the text data of the first page. const result = await app.ActivePDF.PageTextData(1); console.log(result) }
ActivePDF.GetSelectionEndPos()
Obtains the selection.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.GetSelectionEndPos()expression: an Application object.
Return values
Parameter
Type
Description
hasSelection
Boolean
Indicates whether the PDF file has a selection. Valid values:
true
false
x
Number
The x-coordinate of the selection.
y
Number
The y-coordinate of the selection.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the selection. const selectionEndPos = await app.ActivePDF.GetSelectionEndPos(); console.log(selectionEndPos); }
ActivePDF.GetTextSelection()
Obtains the text in the selection.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.GetTextSelection()expression: an Application object.
Return values
Parameter
Type
Description
Text
String
The text in the selection.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the text in the selection. const selectionText = await app.ActivePDF.GetTextSelection(); console.log(selectionText); }
ActivePDF.SetCopyToastVisible()
Sets whether to show a toast message for copy operations.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.SetCopyToastVisible(Visible)expression: an Application object.
Parameters
Parameter
Type
Required
Description
Visible
Boolean
No
Specifies whether to show a copy toast message. Valid values:
false (default)
true
Example
async function example() { await instance.ready(); const app = instance.Application; // Show a toast message for copy operations. await app.ActivePDF.SetCopyToastVisible(true); }
ActivePDF.GetFileCreator()
Obtains the creator of the file.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.GetFileCreator()expression: an Application object.
Return values
Parameter
Type
Description
result
String
The creator of the file.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the creator of the file. const creator = await app.ActivePDF.GetFileCreator(); console.log(creator); }
ActivePDF.GetScreenModeInPlay()
Obtains the play mode of the active PDF document.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.GetScreenModeInPlay()expression: an Application object.
Return values
Parameter
Type
Description
mode
String
The play mode.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the play mode. const mode = await app.ActivePDF.GetScreenModeInPlay(); console.log(mode); }
ActivePDF.BuiltinDocumentProperties()
Obtains the specified built-in document property.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.BuiltinDocumentProperties(Name)expression: an Application object.
Parameters
Parameter
Type
Required
Description
Name
String
Yes
The name of the property.
Return values
Parameter
Type
Description
documnet
DocumentProperty
A property object.
Name: the name of the property.
Value: the value of the property.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the Title property object of the document. const Title = await app.ActivePDF.BuiltinDocumentProperties('Title'); console.log(Title); }
ActivePDF.GetPageWidth()
Obtains the width of the page specified by a page number.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.GetPageWidth(PageIndex)expression: an Application object.
Parameters
Parameter
Type
Required
Description
PageIndex
Number
Yes
The page number.
Return values
A
Numberthat indicates the width of the page.Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the width of the specified page. const pageWidth = await app.ActivePDF.GetPageWidth(1); console.log(pageWidth); }
ActivePDF.GetPageHeight()
Obtains the height of the page specified by a page number.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.GetPageHeight(PageIndex)expression: an Application object.
Parameters
Parameter
Type
Required
Description
PageIndex
Number
Yes
The page number.
Return values
A
Numberthat indicates the height of the page.Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the height of the specified page. const pageHeight = await app.ActivePDF.GetPageHeight(1); console.log(pageHeight); }
ActivePDF.GetPointPageInfoByWinPoint()
Obtains the coordinates of the center point on the PDF page and the page number based on the specified coordinates on the window.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.GetPointPageInfoByWinPoint(x, y)expression: an Application object.
Parameters
Parameter
Type
Required
Description
x
Number
Yes
The x-coordinate on the window.
y
Number
Yes
The y-coordinate on the window.
Return values
Parameter
Type
Description
inContentRange
Boolean
Indicates whether the coordinates are inside the PDF document. Valid values:
true
false
NoteIf the return value is
false, the following properties have no return values:pageindex,x, andypageIndex
Number
The page number of the original page on which the specified coordinates are located.
x
Number
The x-coordinate of the center point on the PDF page that corresponds to the specified point.
y
Number
The y-coordinate of the center point on the PDF page that corresponds to the specified point.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the coordinates of the center point on the PDF page and the page number based on the specified coordinates on the window. const pointPageInfo = await app.ActivePDF.GetPointPageInfoByWinPoint(500,500); console.log(pointPageInfo); }
ActivePDF.RotatePage()
Rotates the PDF document.
Syntax
expression.ActivePDF.RotatePage(Value)expression: an Application object.
Parameters
Parameter
Type
Required
Description
Value
Number
No
The rotation angle. Valid values:
The parameter can be left empty. If the parameter is left empty, the rotation angle is 90 degrees.
0: The rotation angle is 0 degrees.
90: The rotation angle is 90 degrees.
180: The rotation angle is 180 degrees.
270: The rotation angle is 270 degrees.
Example
//@file=base.pdf async function example() { await instance.ready(); const app = instance.Application; const success = await app.ActivePDF.RotatePage(); console.log('success: ', success); }
ActivePDF.SetSupportSelectArea()
Enables or disables area selection.
Only JS-SDK V1.1.19 and later support this feature.
Syntax
expression.ActivePDF.SetSupportSelectArea({isSupport})expression: an Application object.
Parameters
Parameter
Type
Value
Required
Description
isSupport
Boolean
true
No
Enables area selection.
isSupport
Boolean
false
No
Disables area selection.
Example
async function example() { await instance.ready(); const app = instance.Application; // Enable area selection. await app.ActivePDF.SetSupportSelectArea({ isSupport: true }); }
ActivePDF.PageCommentData()
Obtains comments on the specified page.
Only JS-SDK V1.1.19 and later support this feature.
Syntax
expression.ActivePDF.PageCommentData({PageIndex})expression: an Application object.
Parameters
Parameter
Type
Required
Description
PageIndex
Number
Yes
The page number. Page numbers start from 1.
Return values
Parameter
Type
Description
-
Array
An array.
Comment data
Parameter
Type
Description
id
String
The comment ID.
items
Array
The comment data.
Example
async function example() { await instance.ready(); const app = instance.Application; const data = await app.ActivePDF.PageCommentData({ PageIndex: 1 }); console.log('data: ', data); }
ActivePDF.Find()
Finds all the occurrences of the specified string and selects the first occurrence of the string starting from the beginning of the document or the current cursor position.
Only JS-SDK V1.1.19 and later support this feature.
Syntax
expression.ActivePDF.Find({Value})expression: an Application object.
Parameters
Parameter
Type
Required
Description
Value
String
No
The string to search for.
Example
async function example() { await instance.ready(); const app = instance.Application; await app.ActivePDF.Find({ Value: 'hello' }); }
ActivePDF.FindNext()
Finds the next occurrence of the specified string.
Only JS-SDK V1.1.19 and later support this feature.
Syntax
expression.ActivePDF.FindNext()expression: an Application object.
Example
async function example() { await instance.ready(); const app = instance.Application; await app.ActivePDF.FindNext(); }
ActivePDF.FindPrev()
Finds the previous occurrence of the specified string.
Only JS-SDK V1.1.19 and later support this feature.
Syntax
expression.ActivePDF.FindPrev()expression: an Application object.
Example
async function example() { await instance.ready(); const app = instance.Application; await app.ActivePDF.FindPrev(); }
ActivePDF.DiscardFind()
Discards the find operation.
Only JS-SDK V1.1.19 and later support this feature.
Syntax
expression.ActivePDF.DiscardFind()expression: an Application object.
Example
async function example() { await instance.ready(); const app = instance.Application; await app.ActivePDF.DiscardFind(); }
ActivePDF.OpenAnnoList()
Opens the comment list.
Only JS-SDK V1.1.19 and later support this feature.
Syntax
expression.ActivePDF.OpenAnnoList()expression: an Application object.
Example
async function example() { await instance.ready(); const app = instance.Application; await app.ActivePDF.OpenAnnoList(); }
Properties
ActivePDF.CurrentPage
Obtains the current page number.
Syntax
expression.ActivePDF.CurrentPageexpression: an Application object.
Return values
A
Numberthat indicates the page number.Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the current page number. const curryPage = await app.ActivePDF.CurrentPage; console.log(curryPage); }
ActivePDF.DocumentMap
Shows or hides the document map.
Syntax
expression.ActivePDF.DocumentMap = Booleanexpression: an Application object.
If you set
Booleantotrue, the document map is displayed. If you set Boolean tofalse, the document map is hidden.Example
async function example() { await instance.ready(); const app = instance.Application; // Show the document map. app.ActivePDF.DocumentMap = true; }
ActivePDF.PageMode
Sets whether to display the document in a single-page view or multi-page view.
Syntax
expression.ActivePDF.PageMode=Numberexpression: an Application object.
If you set
Numberto1, the document is in a single-page view. If you set Number to0, the document is in a multi-page view.Example
async function example() { await instance.ready(); const app = instance.Application; // Set the single-page view. app.ActivePDF.PageMode = 1; }
ActivePDF.PagesCount
Obtains the total number of pages in the document.
Syntax
expression.ActivePDF.PagesCountexpression: an Application object.
Return values
A Number that indicates the total number of pages.
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the total number of pages in the document. const totalPages = await app.ActivePDF.PagesCount; console.log(totalPages); }
ActivePDF.Zoom
Sets or obtains the zoom percentage of the window.
Syntax
expression.ActivePDF.Zoomexpression: an Application object.
Return values
A
Numberthat represents the zoom percentage.Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the window zoom percentage. The default zoom percentage is 100%. const result = await app.ActivePDF.Zoom; console.log(result); // Set the zoom percentage. app.ActivePDF.Zoom = 66; }
ActivePDF.ZoomToFit
Sets whether to zoom the view to fit a window after the window is resized.
Syntax
expression.ActiveWindow.View.ZoomToFit=Numberexpression: an Application object.
Valid values of Number:
-1: zooms the view to fit the resized window.
0: does not zoom the view.
Example
async function example() { await instance.ready(); const app = instance.Application; // Do not zoom the view for window size fitting. app.ActivePDF.ZoomToFit = 0; }
ActivePDF.Scroll
Obtains the position the document is scrolled to.
Only JS-SDK V1.1.10 and later support this feature.
Syntax
expression.ActivePDF.Scrollexpression: an Application object.
Return values
The coordinates
{x:xx,y:yy}of the position.xxis the x-coordinate andyyis the y-coordinate.Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the position the document is scrolled to. const result = await app.ActivePDF.Scroll; console.log(result); }
ActivePDF.PlayMode
Sets or obtains the play status.
Only JS-SDK V1.1.10 and later support this feature.
Syntax
expression.ActivePDF.PlayModeexpression: an Application object.
Valid values:
true: starts playing.
false: exits playing.
start: plays from the first page.
active: plays from the current page.
Example
async function example() { await instance.ready(); const app = instance.Application; const pdf = await app.ActivePDF; // Specify the play status. pdf.PlayMode = "start"; // Obtain the play status. const mode = await pdf.PlayMode; console.log(mode); }
ActivePDF.DragMode
Sets the drag mode or obtains the drag mode status.
Only JS-SDK V1.1.10 and later support this feature.
Syntax
expression.ActivePDF.DragModeexpression: an Application object.
Valid values:
true: enters the drag mode.
false: exits the drag mode.
Example
async function example() { await instance.ready(); const app = instance.Application; const pdf = await app.ActivePDF; // Enter the drag mode. pdf.DragMode = true; // Obtain the drag mode status. const mode = await pdf.DragMode; console.log(mode); }
ActivePDF.ShowPages
Obtains all page indexes in the viewable range.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.ShowPagesexpression: an Application object.
Return values
An
Arraythat includes all page indexes in the viewable range.Example
async function example() { await instance.ready(); const app = instance.Application; const pdf = await app.ActivePDF; // Obtain all page indexes in the viewable range. const pages = await pdf.ShowPages; console.log(pages); }
ActivePDF.ShowPagesTextData
Obtains the text data of all pages in the viewable range.
Only JS-SDK V1.1.12 and later support this feature.
Syntax
expression.ActivePDF.ShowPagesTextDataexpression: an Application object.
Return values
An
Arraythat includes the text data of all pages in the viewable range.Parameter
Type
Description
pg
Number
The page number.
content
String
The text data.
Example
async function example() { await instance.ready(); const app = instance.Application; const pdf = await app.ActivePDF; // Obtain the text data of all pages in the viewable range. const result = await pdf.ShowPagesTextData; console.log(result); }
ActivePDF.ReadOnly
Checks whether the active document is read-only.
Only JS-SDK V1.1.14 and later support this feature.
Syntax
expression.ActivePDF.ReadOnlyexpression: an Application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Check whether the active document is read-only. const ReadOnly = await app.ActivePDF.ReadOnly; }
ActivePDF.ReadOnlyComment
Checks whether the active document is read-only and allows comments.
Only JS-SDK V1.1.15 and later support this feature.
Syntax
expression.ActivePDF.ReadOnlyCommentexpression: an Application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Check whether the active document is read-only and allows comments. const ReadOnlyComment = await app.ActivePDF.ReadOnlyComment; }
ActivePDF.SupportReadOnlyComment
Checks whether the active document supports read-only access and commenting.
Only JS-SDK V1.1.15 and later support this feature.
Syntax
expression.ActivePDF.SupportReadOnlyCommentexpression: an Application object.
Example
async function example() { await instance.ready(); const app = instance.Application; // Check whether the active document supports read-only access and commenting. const SupportReadOnlyComment = await app.ActivePDF.SupportReadOnlyComment; }