• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Where does Acrobat show the oIcon which can be added to the StateModel?

New Here ,
Sep 27, 2022 Sep 27, 2022

Copy link to clipboard

Copied

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.

TOPICS
Acrobat SDK and JavaScript

Views

641

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 27, 2022 Sep 27, 2022

Copy link to clipboard

Copied

I tested adding a custom state model on the latest 32bit Acrobat and it works for just text state names, with no icons. 

I also tested it using some icons. The new model and the specified status text showed up on the "set status" menu and allowed selections. However, the icons never appeared. I used both 16x16 and 20x20 icon streams that I already know work as toolbar button icons.  Don't know if there is a problem with the icons or there is some other issue, but the since the status text displayed where it should I suspect you have a different problem. 

 

Where is this code being run?  Did you check the console window for errors?

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

Thanks for your reply. 
The console does not show any errors. 
Interessting is that you report, that the custom states are shown in your filter dialogue, right? It was passible for me to use the custom states in the to set the state, but it was not shown in the comment and it was not possibile to filter the comments.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

I now retested the script with Adobe Acrobat Pro DC Continuous Release Version 2022.002.20191 64Bit. 

Still, behaives as described. Icons nowhere visible. Custom Status only available with the script as posted here. But this is not user friendly and therefore not usable in production. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

LATEST

It appears the icons don't work for a custom state model.  Report this as a bug.

https://www.adobe.com/products/wishform.html

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines