I'm trying to get the current page number from the viewer using the codes below, but have not been successful.
Could anyone please tell me what I'm doing wrong?
Code: Select all
int ptr = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
short type = OLE.VT_BYREF | OLE.VT_I4;
Variant currPage = new Variant(ptr, type);
automation.invoke(
getDispatcherId("GetDocumentProperty"),
new Variant[] {
new Variant(documentId),
new Variant("Pages.Current"),
currPage,
new Variant(0)
});
int currentPage = currPage.getInt();