Annotations

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

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

milonass
User
Posts: 35
Joined: Tue Oct 06, 2015 1:09 pm

Annotations

Post by milonass »

I would like to add an annotation programmatically from an image file or a pdf file using the JS method. Where in the file system do I have to store the annotation file?
More precisely I tried the following:

Code: Select all

xchange.RunJavaScript(LPCTSTR(_T("var annot = this.addAnnot\({page: 0, type : \"Stamp\", opacity: \"1.0\",author: \" \",name: \"Stamp\", rect: [0,0,100,100], contents: \"Bla\", AP: \"a67a2568-ab5d-4c66-ba3e-2de1f3a027f0\"}) ")), &rs.m_str, 0, 0);
where the guid is the filename of the Annotation file created by the end user application. This does not work. On the other hand, this does work:

Code: Select all

xchange.RunJavaScript(LPCTSTR(_T("var annot = this.addAnnot\({page: 0, type : \"Stamp\", opacity: \"1.0\",author: \" \",name: \"Stamp\", rect: [0,0,100,100], contents: \"Bla\", AP: \"Approved\"}) ")), &rs.m_str, 0, 0);


So the question is: What ID has to be inserted after "AP" and how can it be found out?

Thank you,
Thomas
User avatar
Vasyl-Tracker Dev Team
Site Admin
Posts: 2353
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Annotations

Post by Vasyl-Tracker Dev Team »

Hi, Thomas.

Possible way to do it - you must look into file:

"c:\Users\<UserName>\AppData\Roaming\Tracker Software\PDF-XChange Viewer\2.0\Stamps\<StampCollectionUID>.pdf"

find the string similar to:

/Names [(004d1334-f2e8-4b52-94ae588b886c090f=New Stamp) ... ]

i.e in format <StampGUID>=<Stamp Name>

and use <StampGUID> in your script. Note - your script contains small issue "addAnnot\(". Should be "addAnnot(", without "\" before bracket..

Small tip: open our Viewer end-user program and show drop-down menu for stamps tool on the toolbar you will see the necessary <StampGUID> in tooltip when you moving over stamp item holding Ctrl key.

HTH.
Vasyl Yaremyn
Tracker Software Products
Project Developer

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.