Getting Current Page Number (Eclipse RCP/SWT ActiveX)

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

jykim
User
Posts: 37
Joined: Fri Oct 02, 2009 12:30 am

Getting Current Page Number (Eclipse RCP/SWT ActiveX)

Post by jykim »

Hi,

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();
Thanks for your help!
jykim
User
Posts: 37
Joined: Fri Oct 02, 2009 12:30 am

Re: Getting Current Page Number (Eclipse RCP/SWT ActiveX)

Post by jykim »

It seems like any "GetProperty" methods with "DataOut" parameter are not working.
For example, I was trying to invoke this -

Code: Select all

GetProperty("Commands.Count", DataOut, 0);
with the following codes, but it doesn't work.

Code: Select all

int ptr = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, Variant.sizeof);
short type = OLE.VT_BYREF | OLE.VT_I4;

Variant cmdCount = new Variant(ptr, type);

automation.invoke(
	getDispatcherId("GetProperty"), 
	new Variant[] { 
		new Variant("Commands.Count"),
		cmdCount,
		new Variant(0)
	});

int cnt = cmdCount.getInt();
I'm wondering if the problem is in PDFV AX or in Java/SWT/ActiveX???
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Getting Current Page Number (Eclipse RCP/SWT ActiveX)

Post by Vasyl - PDF-XChange »

Please change your code:

Code: Select all

short type = OLE.VT_BYREF | OLE.VT_I4;
to

Code: Select all

short type = OLE.VT_BYREF | OLE.VT_VARIANT;
Best
Regards
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
jykim
User
Posts: 37
Joined: Fri Oct 02, 2009 12:30 am

Re: Getting Current Page Number (Eclipse RCP/SWT ActiveX)

Post by jykim »

Great! Thanks Vasyl. :D
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: Getting Current Page Number (Eclipse RCP/SWT ActiveX)

Post by John - Tracker Supp »

Pleasure :)
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com