Javascript syncAnnotScan

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

ugradedeveloper
User
Posts: 223
Joined: Wed Aug 22, 2007 4:40 pm

Javascript syncAnnotScan

Post by ugradedeveloper »

In looking at the Adobe Javascript documentation, I noticed there is a method Doc.syncAnnotScan() which is supposed to be called before calling Doc.getAnnots().

syncAnnotScan() is not listed among the supported Doc methods in the PDF-XChange documentation. However, if I include this function in some Javascript that I pass to RunJavaScript, it does not produce an error; so evidently this function is implemented in your system.

My question is, do we need to use syncAnnotScan() as we would when using Adobe, or is it just included for compatibility?

I am particularly interested in this because I have a problem in my application where the order of the annotations returned by getAnnots() seems to be inconsistent sometimes. In other words, a particular annotation might be in the first position in the array at one instance, and then after a subsequent call to getAnnots() it might appear at a different position in the array. I can't reproduce this problem at will, so it's difficult for me to test any changes that I might attempt to fix it. However, I wonder if putting in a call to syncAnnotScan() before each call to getAnnots() would make a difference.

Thanks.
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: Javascript syncAnnotScan

Post by Corwin - Tracker Sup »

Well, "syncAnnotScan" function indeed works with annots, but in PDF-XChange Viewer there is no difference if you will use it or not.
ugradedeveloper
User
Posts: 223
Joined: Wed Aug 22, 2007 4:40 pm

Re: Javascript syncAnnotScan

Post by ugradedeveloper »

Corwin wrote:Well, "syncAnnotScan" function indeed works with annots, but in PDF-XChange Viewer there is no difference if you will use it or not.
That's interesting... I'm actually sorry to hear that. I was hoping that I could fix the bug in my application by just inserting this function call.

In that case I need to ask: given that getAnnots() returns an array of annotations, is the ordering of this array well-defined? Or is it possible that the order could change from one invocation to the next?

Would it make a difference if there are unsaved changes to the document at the time of calling getAnnots()? [That is to say, if comments have been added or changed and those changes not saved].

Thanks.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3586
Joined: Thu Jul 08, 2004 10:36 pm

Re: Javascript syncAnnotScan

Post by Ivan - Tracker Software »

now the getAnnots function is rewritten to handle sort order, filters, etc., by the way, in only implementations all annots on specified page(s) was enumerated page-by-page in the order which they are listed on the page.

when you edit annots on the page their order isn't changed (provided you don't delete them).

Newly created annots are added to the end of the list.

HTH
PDF-XChange Co Ltd. (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.