Get Created Date of annot state

PDF-XChange Editor SDK for Developers

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

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Get Created Date of annot state

Post by lidds »

I am running the below JavaScript code to get the annotation states and return information on them. However what I would like is to get the Creation Date of the state instead of the Modified Date, is this possible?

I have tried changing the modDate to creationDate and searched through the Acrobat API manual but could not find any reference.

Code: Select all

{var stateResults;
var returnResults;
returnResults = "";
var annot = this.getAnnot(0,"8d3ec689-a6bb-4e07-852e5992f5eb6a6b")
if (annot == null) {
res = "None";
} else {
var states = annot.getStateInModel("Review");
var state;
stateResults = "";
if (states.length > 0) {
for (k = 0; k < states.length; k++) {
state = "";
var s = states[k].state;
var d = util.printd(2, states[k].modDate);
var a = states[k].author;
state = s;
if (state === "");
stateResults = s + "|" + d + "|" + a + "|" + annot.name;
returnResults = returnResults + stateResults + "~";
}
}
var states = annot.getStateInModel("MyAppState");
var state;
stateResults = "";
if (states.length > 0) {
for (k = 0; k < states.length; k++) {
state = "";
var s = states[k].state;
var d = util.printd(2, states[k].modDate);
var a = states[k].author;
state = s;
if (state === "");
stateResults = s + "|" + d + "|" + a + "|" + annot.name;
returnResults = returnResults + stateResults + "~";
}
}
if (returnResults == "") {
res = "None";
} else {
res = returnResults;
}
}
}
Thanks

Simon
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Get Created Date of annot state

Post by Tracker Supp-Stefan »

Hello Simon,

there is an .getProps() method for annotations so that you can copy all the properties of a specific annotation.
And you do have both "modDate" and "creationDate" for all annotations. Of course creationDate is read only, while modDate can be written into.
image.png
image.png (18.29 KiB) Viewed 537 times
Kind regards,
Stefan
lidds
User
Posts: 510
Joined: Sat May 16, 2009 1:55 pm

Re: Get Created Date of annot state

Post by lidds »

Hi Stefan,

Thank you for your response.

The problem is that the .getProps() works on annots, but does NOT work on a state object.

Code: Select all

var p = states[k].getProps();
for ( o in p ) console.println( o + " : " + p[o] ); 
Gives the following error:

Console:Exec:19: TypeError: states[k].getProps is not a function

Do you have any other ideas?

Thanks

Simon
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8440
Joined: Wed Jan 03, 2018 6:52 pm

Re: Get Created Date of annot state

Post by TrackerSupp-Daniel »

Hello, lidds

I have spoken with the Dev team on this and have some unfortunate news for you. I will paste their findings below:
Dev Team wrote:as far as I see, the JS documentation does not specifies the list of properties that should be available in the state elements returned by getStateInModel method.
We return the same amount of properties that Acrobat does: Name, author, modDate, state, and stateModel.
If we will add, say, creationDate, it will make the code that relays on the presence of this property incompatible with Acrobat or other PDF apps.
As such, it seems that this property will not be added to our software at this time, in the name of retained compatibility with our competitors.

Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Post Reply