Help adding custom toolbar icons to add-in tools
Copy link to clipboard
Copied
I have three simple javascript add-ins that I have used successfully for years. I would like to add custom icons to them, but am having problems. When I use this code, I get an error saying "this.importIcon is not a function". I am a cut-and-paste Javascripter so likely I'm making a simple mistake. Could anyone tell me what it is and how to fix it? Thank you!
this.importIcon("myIconCW", "/D/J/CAD Standards/Stamps/Acrobat tools/clockwise.jpg", 0);
this.importIcon("myIconCCW", "/D/J/CAD Standards/Stamps/Acrobat tools/counterclockwise.jpg", 0);
this.importIcon("myIconFlat", "/D/J/CAD Standards/Stamps/Acrobat tools/flatten.jpg", 0);
var cwIcon = util.iconStreamFromIcon(this.getIcon("myIconCW"));
var ccwIcon = util.iconStreamFromIcon(this.getIcon("myIconCCW"));
var flatIcon = util.iconStreamFromIcon(this.getIcon("myIconFlat"));
app.addToolButton({cName: "MyFlattenButton",
cLabel: "Flatten",
oIcon: flatIcon,
cEnable: "event.rc = (app.doc != null);",
cExec: "flattenPages();"
});
app.addToolButton({cName: "MyCWButton",
cLabel: "CW",
oIcon: cwIcon,
cEnable: "event.rc = (app.doc != null);",
cExec: "rotatepage(this.pageNum,90);"
});
app.addToolButton({cName: "MyCCWButton",
cLabel: "CCW",
oIcon: ccwIcon,
cEnable: "event.rc = (app.doc != null);",
cExec: "rotatepage(this.pageNum,270);"
});
function rotatepage(pageno,degrees) {
var rotateangle = this.getPageRotation(pageno);
var newangle = (rotateangle + degrees) % 360;
this.setPageRotations(pageno,pageno,newangle);
return 0;
}
Copy link to clipboard
Copied
I won't be doing it until the holidays, when I have some time.
Use the Acrobat JavaScript Reference early and often


-
- 1
- 2