Where does Acrobat show the oIcon which can be added to the StateModel?
- September 27, 2022
- 1 reply
- 1585 views
The default Comment Statemodel does not support all our needs, therefore I looked into the option to add via collab.addStateModel a custom Statemodel. (I'm using Acrobat Pro DC (32-bit)
My example code is below.
Note: To make shure that importIcon works, I allow the dialog to pop-up for now.
try {
var myDoc = app.newDoc();
var myAnnot = myDoc.addAnnot({page: 0,type: "Text",point: [300,400],name: "myAnnot",});
// import icon (20x20 pixels) from the file specified
myDoc.importIcon("my_initial");
oIcon_initial = util.iconStreamFromIcon(myDoc.getIcon("my_initial"));
// import icon (20x20 pixels) from the file specified
myDoc.importIcon("my_accepted");
oIcon_accpeted = util.iconStreamFromIcon(myDoc.getIcon("my_accepted"));
// import icon (20x20 pixels) from the file specified
myDoc.importIcon("my_marked");
oIcon_marked = util.iconStreamFromIcon(myDoc.getIcon("my_marked"));
// import icon (20x20 pixels) from the file specified
myDoc.importIcon("my_negotiate");
oIcon_negotiate = util.iconStreamFromIcon(myDoc.getIcon("my_negotiate"));
// import icon (20x20 pixels) from the file specified
myDoc.importIcon("my_rejected");
oIcon_rejected = util.iconStreamFromIcon(myDoc.getIcon("my_rejected"));
// import icon (20x20 pixels) from the file specified
myDoc.importIcon("my_done");
oIcon_done = util.iconStreamFromIcon(myDoc.getIcon("my_done"));
// import icon (20x20 pixels) from the file specified
myDoc.importIcon("my_info");
oIcon_info = util.iconStreamFromIcon(myDoc.getIcon("my_info"));
// import icon (20x20 pixels) from the file specified
myDoc.importIcon("my_parked");
oIcon_parked = util.iconStreamFromIcon(myDoc.getIcon("my_parked"));
// import icon (20x20 pixels) from the file specified
myDoc.importIcon("my_help");
oIcon_help = util.iconStreamFromIcon(myDoc.getIcon("my_help"));
var myStates = new Object();
myStates["initial"] = {cUIName: "Not reviewed", oIcon: oIcon_initial};
myStates["accepted"] = {cUIName: "Accepted", oIcon: oIcon_accpeted};
myStates["rejected"] = {cUIName: "Rejected", oIcon: oIcon_rejected};
myStates["marked"] = {cUIName: "Marked", oIcon: oIcon_marked};
myStates["negotiate"] = {cUIName: "Negotiate", oIcon: oIcon_negotiate};
myStates["help"] = {cUIName: "Help", oIcon: oIcon_help};
myStates["info"] = {cUIName: "Just for info", oIcon: oIcon_info};
myStates["parked"] = {cUIName: "Parked", oIcon: oIcon_parked};
myStates["done"] = {cUIName: "Done", oIcon: oIcon_done};
Collab.addStateModel({
cName: "ReviewStates",
cUIName: "Custom",
oStates: myStates,
cDefault: "initial",
bHidden: false,
bHistory: true
});
} catch(e) { console.println(e); }
myAnnot.transitionToState("ReviewStates", "clarify");
myAnnot.transitionToState("ReviewStates", "approved");The result is almost unusable. It neither shows the custom status in the comment nor the icon.
What is the purpose of adding an icon, if it is not shown anywhere?
The only effect which can be recognised is when you run a custom script like this:
annots = this.getAnnots()
for ( var i= 0; i< annots.length; i++) {
states = annots[i].getStateInModel("ReviewStates");
if ( states.length > 0 ) {
for(j = 0; j < states.length; j++)
{
var d = util.printd(2, states[j].modDate);
var s = states[j].state;
var a = states[j].author;
console.println(annots[i].type + ": " + a + " "
+ s + " " + d + "on page "
+ (annots[i].page+1) );
}
}
}But, such a hidden status is pretty unusable. It is even not possible to filter for the custom status.
Is the feature not finished. Is this something which is really released to end-customers.
Please provide help, so we can use to the product in a reasonable way.
