跳到主要内容

GetPagesCount

获取文档页数

语法

expression.GetPagesCount();

expression - 表示 ApiDocument 类的变量。

参数

此方法没有任何参数。

返回值

number

示例

获取文档页数并在文本字段中显示。

// How can I get the pages count using a document in a PDF document?

// Get the pages count for a document in a PDF document.

let doc = Api.GetDocument();
let page = doc.GetPage(0);
let textField = Api.CreateTextField([10, 10, 160, 32]);
page.AddObject(textField);
textField.SetValue(doc.GetPagesCount());