My requirement is to retrieve the current page number while reading the document in the editor, so that it can automatically redirect to the last page viewed during the next loading. Since I couldn’t find the relevant API, I want to implement this by calling macro code. My macro code is as follows:
const fullMacro =
(function () {
debugger;
function getPage(){
console.log('宏代码获取当前页码执行');
let doc = Api.GetDocument();
let page = doc.GetCurrentVisiblePages();
console.log("当前可见页面:", page);
return {page: page};
}
function gotoPage(){
let doc = Api.GetDocument();
console.log('宏代码跳转页码执行');
if (toPage){
doc.GoToPage(50);
}
}
Api.AddCustomFunction(getPage);
Api.AddCustomFunction(gotoPage);
getPage();
gotoPage()
})();
;