How to set annotations as locked or read-only via SDK

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

Post Reply
Prodigy1
User
Posts: 4
Joined: Mon Oct 21, 2013 9:11 pm

How to set annotations as locked or read-only via SDK

Post by Prodigy1 »

Hi there,

Looking for a way to set annotations as locked and/or read-only.

I am able to get a list of annotations on each page using the "GetAnnotsCount" method, but don't see a property/method that can be called to set the 'locked' property. Not sure if ToggleAnnotLockState (36001) plays into this at all?

Ideally we are looking for a way to prevent user "A" from editing/deleting user "B's" comments, but that functionality doesn't appear to exist. Figured this is the next best option.

Came across an earlier post (below) for javascript, but see no way of doing the same outside of js. I feel like I'm missing something very fundamental... Thanks in advance!

https://www.pdf-xchange.com/forum3 ... ock#p15638


EDIT: Was able to leverage the RunJavaScript method to accomplish this:

hr = pdfView->RunJavaScript(StringToOleStr("var annots = this.getAnnots(); for (var i = 0; i < annots.length; i++){ var a = annots; a.lock = true; a.readOnly = true; }"), NULL, 0, 0);

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

Re: How to set annotations as locked or read-only via SDK

Post by Vasyl-Tracker Dev Team »

Hi Prodigy1.

Sorry, but no way to do it in Viewer SDK without using the JS.
But you may use new Editor SDK for it as well.

Cheers.
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.
Post Reply