Jump to page with first comment

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

cew
User
Posts: 213
Joined: Tue Feb 01, 2011 8:14 am

Jump to page with first comment

Post by cew »

Hi,

is there a way to jump to the page with the first available comment?


Best regards
cew
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Jump to page with first comment

Post by Stefan - PDF-XChange »

Hello Cew,

You should be able to do that via JS as well.
Go through your pages, and find the first one with annotations, then use the GotoPage command to go to that page.

Best,
Stefan
cew
User
Posts: 213
Joined: Tue Feb 01, 2011 8:14 am

Re: Jump to page with first comment

Post by cew »

Tracker Supp-Stefan wrote: You should be able to do that via JS as well.
What do you mean by "as well"?
I have not worked with JS in combination with the SDK.
I'd prefere a solution using c#.
Tracker Supp-Stefan wrote: Go through your pages, and find the first one with annotations, then use the GotoPage command to go to that page.
Is there another way to get the annotations directly?

Best
cew
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Jump to page with first comment

Post by Vasyl - PDF-XChange »

Hi cew.

Code example for this:

Code: Select all

int pagesCount;
pdfViewer.GetDocumentProperty(docId, "Pages.Count", out pagesCount);
int i = 0;
int firstPageWithAnnots = -1;
while (i < pagesCount)
{
     int annotsCount = 0;
     pdfViewer.DoDocumentVerb(docId, "Pages[" + i + "]", "GetAnnotsCount", stub, out annotsCount, 0);
     if (annotsCount != 0)
     {
          firstPageWithAnnots = i;
          break;
     }
     i++;
}
if (firstPageWithAnnots >= 0)
     pdfViewer.SetDocumentProperty(docId, "Pages.Current", firstPageWithAnnots, 0);
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.
cew
User
Posts: 213
Joined: Tue Feb 01, 2011 8:14 am

Re: Jump to page with first comment

Post by cew »

Great! Thank you!

Best regards
cew
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Jump to page with first comment

Post by Stefan - PDF-XChange »

:)