customizing icons add-on toolbar without opening document.

Forum for the PDF-XChange Editor - Free and Licensed Versions

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

Post Reply
ng80092a
User
Posts: 21
Joined: Thu May 13, 2021 11:50 am

customizing icons add-on toolbar without opening document.

Post by ng80092a »

Dear,

I'm trying to add icons to my toolbar on startup, even if no document is opened.

However, this is only possible using the importIcon function, but that requires an opened document.

I'm using the .js file on the JavaScript Roaming folder, and everything works fine, but I cannot start a new document with it, which would allow to import the icon, neither importIcon without a opened document.

Here's a code sample, that fails to create a new document:

Code: Select all

var myDoc = app.newDoc();
myDoc.importIcon("myIcon", "/C/Icons/lockico.png", 0);
oIcon = util.iconStreamFromIcon(myDoc.getIcon("myIcon"));

app.addToolButton({

    cName: "Unlock stamp",
    cLabel: "Unlock stamp",
    cExec: "unlockstamp()",
    cTooltext: "Unock stamp",
    cEnable: true,
    nPos: 1,
  oIcon: oIcon

});
Could you please advise?

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

Re: customizing icons add-on toolbar without opening document.

Post by Tracker Supp-Stefan »

Hello ng80092a,

Welcome to our forums.
Please take a look here for the correct way to add icons to your custom JS commands:
viewtopic.php?f=62&t=28256#p128899

Kind regards,
Stefan
Post Reply