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

Help adding custom toolbar icons to add-in tools

New Here ,
Nov 01, 2022 Nov 01, 2022

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;
}

TOPICS
Acrobat SDK and JavaScript , Windows
4.7K
Translate
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 ,
Nov 08, 2022 Nov 08, 2022
LATEST

I won't be doing it until the holidays, when I have some time. 

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

Translate
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