Page
This topic describes the API operations that are related to the Page object of text documents.
Pages
ActiveDocument.ActiveWindow.ActivePane.Pages
Obtains all pages in a document.
-
Only JS-SDK V1.1.10 and later support this feature.
-
Only PCs support this feature.
-
Syntax
expression.ActiveDocument.ActiveWindow.ActivePane.Pagesexpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain all pages in a document. const words = await app.ActiveDocument.ActiveWindow.ActivePane.Pages; }
Properties
ActiveDocument.ActiveWindow.ActivePane.Pages.Count
You can obtain the total number of pages in the page layout view by using the Count property.
-
Only JS-SDK V1.1.10 and later support this feature.
-
Only PCs support this feature.
-
Syntax
expression.ActiveDocument.ActiveWindow.ActivePane.Pages.Countexpression: the document type application object.
-
Return values
Returns a
Numberthat 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 page layout view. const pages = await app.ActiveDocument.ActiveWindow.ActivePane.Pages.Count; console.log(pages); }
PageSetup
ActiveDocument.Sections.Item(Index).PageSetup
Obtains the PageSetup object.
Only JS-SDK V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Sections.Item(Index).PageSetupexpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the PageSetup object. const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; }
Methods
ActiveDocument.Sections.Item(Index).PageSetup.TypesetToPage()
You can typeset to a page by using the TypesetToPage() method. Text documents are in dynamic layout. You need to specify PageNum, which specifies the number of the first page to be loaded. Subsequent pages are loaded as you scroll the pages.
Only JS-SDK V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Sections.Item(Index).PageSetup.TypesetToPage(PageNum)expression: the document type application object.
-
Parameters
Property
Type
Required
Description
PageNum
Number
Yes
The number of the first page to be loaded.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the PageSetup object. const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; // Typeset to the specified page. await pageSetup.TypesetToPage(2); }
Properties
ActiveDocument.Sections.Item(Index).PageSetup.PageWidth
You can obtain the width of a page by specifying the PageWidth property.
Only JS-SDK V1.1.10 and later support this feature.
-
Syntax
expression.ActiveDocument.Sections.Item(Index).PageSetup.PageWidthexpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Obtain the PageSetup object. const pageSetup = await app.ActiveDocument.Sections.Item(1).PageSetup; // Obtain the width of the page. const pageWidth = await PageSetup.PageWidth; console.log(pageWidth); }