Copy link to clipboard
Copied
I have a folder level JavaScript that is running when Acrobat starts up. I'm able to add a button to the add-ons toolbar without a custom icon but once I try to specify an icon I get an error that doesn't tell me much.
GeneralError: Operation failed.
App.addToolButton:1824:Folder-Level:App:config.js
Here is my code:
var myIcon;
var importIcons = app.trustedFunction(function() {
app.beginPriv();
// Create a document
var myDoc = app.newDoc();
// import icon (20x20 pixels) from the file specified
myDoc.importIcon("myIcon", "/some/path/plus.jpg", 0);
// convert the icon to a stream.
myIcon = util.iconStreamFromIcon(myDoc.getIcon("myIcon"));
// close the doc now that we have grabbed the icon stream
myDoc.closeDoc(true);
app.endPriv();
});
importIcons();
// add buttons to add-ons toolbar
app.addToolButton({
cLabel: "Test1",
cName: "testButton1",
oIcon: myIcon,
cExec: "app.alert('hello');",
cTooltext: "Test1",
cEnable: true,
cMarked: true,
nPos: 0
});
My image is 20x20 px and a .jpg. I'm also wondering if there's a way to accomplish this without having to create a dummy empty document just in order to call importIcon() and getIcon(). Any help is appreciated.
Your hex string worked fine for me. I'm able to generate valid hex strings that display the icon correctly on Windows but not on Mac. I'm just going to assume this is a Mac bug and generate my hex strings on Windows and paste into Mac. Thanks for the help.
Copy link to clipboard
Copied
It is extremely unlikely that there is something wrong with the image format you are starting with. But you probably do have an issue with the way the Hex data is being produced. How exactly are you creating the hex data? Please be specific
Copy link to clipboard
Copied
I've tried generating the hex string in Acrobat using JS:
// create a document
var myDoc = app.newDoc();
// import icon from file
myDoc.importIcon("myIcon", "/some/path/myicon.png", 0);
// convert the icon to a stream
myIcon = util.iconStreamFromIcon(myDoc.getIcon("myIcon"));
// get hex string
var hex = myIcon.read();
// print hex string
console.println(hex);
then plugging that hex into:
var oIcon = {
count: 0,
width: 20,
height: 20,
read: function(nBytes) {
return hex.slice(this.count, this.count += nBytes);
}
};
then passing oIcon to the addToolButton() function. The result was that the image did not display correctly at all. Just a bunch of random black pixels.
I then tried the tool suggested above on the same icon image:
https://files.acrobat.com/a/preview/1e380a30-b776-49cb-8652-…​
That gave a similar result. I then tried generating the hex string using the PDF tool above on the image provided further up in this thread:
https://forums.adobe.com/servlet/JiveServlet/showImage/2-10069142-1382811/Compteur-de-mots.png
That gave a similar result. Here is the hex string the tool generated for the image above:
0000000000000000ff8b1100ff8b1100ff970e1dff970e1dff860000ff860000ffc3091affc3091affa00000ffa00000ffa40802ffa40802ff9a0000ff9a0000ff940003ff940003ffa30712ffa30712ff9f0307ff9f0307ffa20407ffa20407ffa30005ffa30005ff990000ff990000ff9b0a06ff9b0a06ff920100ff920100ffb00e1effb00e1eff8e0000ff8e0000ffa31201ffa3120100000000000000000000000000000000ff8b1100ff8b1100ff970e1dff970e1dff860000ff860000ffc3091affc3091affa00000ffa00000ffa40802ffa40802ff9a0000ff9a0000ff940003ff940003ffa30712ffa30712ff9f0307ff9f0307ffa20407ffa20407ffa30005ffa30005ff990000ff990000ff9b0a06ff9b0a06ff920100ff920100ffb00e1effb00e1eff8e0000ff8e0000ffa31201ffa312010000000000000000ff951b00ff951b00ff7b0100ff7b0100ff950b1aff950b1affae1529ffae1529ffa50000ffa50000ffbe050dffbe050dff980000ff980000ffa50b04ffa50b04ff990008ff990008ff9f040eff9f040eff9f0408ff9f0408ff920000ff920000ffa10003ffa10003ffa9060affa9060aff900000ff900000ff960501ff960501ff980007ff980007ffbc1b2bffbc1b2bff7e0000ff7e0000ff9e240aff9e240aff951b00ff951b00ff7b0100ff7b0100ff950b1aff950b1affae1529ffae1529ffa50000ffa50000ffbe050dffbe050dff980000ff980000ffa50b04ffa50b04ff990008ff990008ff9f040eff9f040eff9f0408ff9f0408ff920000ff920000ffa10003ffa10003ffa9060affa9060aff900000ff900000ff960501ff960501ff980007ff980007ffbc1b2bffbc1b2bff7e0000ff7e0000ff9e240aff9e240aff840001ff840001ffb1272effb1272e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff90180cff90180cff930000ff930000ff840001ff840001ffb1272effb1272e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff90180cff90180cff930000ff930000ff970d13ff970d13ff840001ff8400010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff830a00ff830a00ff970100ff970100ff970d13ff970d13ff840001ff8400010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff830a00ff830a00ff970100ff970100ffaf0009ffaf0009ffa80002ffa800020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff9f070eff9f070effaa0009ffaa0009ffaf0009ffaf0009ffa80002ffa800020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff9f070eff9f070effaa0009ffaa0009ffab0004ffab0004ffb6030fffb6030f000000000000000000000000000000000000000000000000ff4c2b21ff4c2b21ff6e1417ff6e1417ff650b0eff650b0eff6e1324ff6e1324ff600919ff600919ff6d2227ff6d2227ff5c1115ff5c1115ff6a1b23ff6a1b23ff702029ff702029ff461d19ff461d19000000000000000000000000000000000000000000000000ff8e0000ff8e0000ffa00000ffa00000ffab0004ffab0004ffb6030fffb6030f000000000000000000000000000000000000000000000000ff4c2b21ff4c2b21ff6e1417ff6e1417ff650b0eff650b0eff6e1324ff6e1324ff600919ff600919ff6d2227ff6d2227ff5c1115ff5c1115ff6a1b23ff6a1b23ff702029ff702029ff461d19ff461d19000000000000000000000000000000000000000000000000ff8e0000ff8e0000ffa00000ffa00000ffaa090cffaa090cffa00002ffa00002000000000000000000000000000000000000000000000000ff4f1914ff4f1914ff7b1d1cff7b1d1cff781a19ff781a19ff6e1e25ff6e1e25ff58090fff58090fff6b1617ff6b1617ff72181bff72181bff75141eff75141eff6f0e1aff6f0e1aff511d1cff511d1c000000000000000000000000000000000000000000000000ffa30002ffa30002ffae0a09ffae0a09ffaa090cffaa090cffa00002ffa00002000000000000000000000000000000000000000000000000ff4f1914ff4f1914ff7b1d1cff7b1d1cff781a19ff781a19ff6e1e25ff6e1e25ff58090fff58090fff6b1617ff6b1617ff72181bff72181bff75141eff75141eff6f0e1aff6f0e1aff511d1cff511d1c000000000000000000000000000000000000000000000000ffa30002ffa30002ffae0a09ffae0a09ffa00002ffa00002ffa00002ffa000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffa80307ffa80307ff970000ff970000ffa00002ffa00002ffa00002ffa000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffa80307ffa80307ff970000ff970000ffa10305ffa10305ff9c0000ff9c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffa30300ffa30300ffa40100ffa40100ffa10305ffa10305ff9c0000ff9c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffa30300ffa30300ffa40100ffa40100ff9d0001ff9d0001ffa40609ffa40609000000000000000000000000000000000000000000000000ff58231fff58231fff5d2115ff5d2115ff5c1f13ff5c1f13ff47150eff47150eff63322bff63322bff601b13ff601b13ff5f1510ff5f1510ff65181aff65181aff65161eff65161eff4a181bff4a181b000000000000000000000000000000000000000000000000ffa30300ffa30300ffa40100ffa40100ff9d0001ff9d0001ffa40609ffa40609000000000000000000000000000000000000000000000000ff58231fff58231fff5d2115ff5d2115ff5c1f13ff5c1f13ff47150eff47150eff63322bff63322bff601b13ff601b13ff5f1510ff5f1510ff65181aff65181aff65161eff65161eff4a181bff4a181b000000000000000000000000000000000000000000000000ffa30300ffa30300ffa40100ffa40100ff9e0000ff9e0000ffa60700ffa60700000000000000000000000000000000000000000000000000ff542617ff542617ff61210bff61210bff691a09ff691a09ff6d1911ff6d1911ff771c16ff771c16ff6d1004ff6d1004ff73160aff73160aff5c130aff5c130aff632720ff632720ff582821ff582821000000000000000000000000000000000000000000000000ffa80005ffa80005ffa60004ffa60004ff9e0000ff9e0000ffa60700ffa60700000000000000000000000000000000000000000000000000ff542617ff542617ff61210bff61210bff691a09ff691a09ff6d1911ff6d1911ff771c16ff771c16ff6d1004ff6d1004ff73160aff73160aff5c130aff5c130aff632720ff632720ff582821ff582821000000000000000000000000000000000000000000000000ffa80005ffa80005ffa60004ffa60004ffa20400ffa20400ff9d0000ff9d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffa80005ffa80005ffa60004ffa60004ffa20400ffa20400ff9d0000ff9d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffa80005ffa80005ffa60004ffa60004
I also tried generating the hex string from the image file path in Java.
Copy link to clipboard
Copied
You're first bit of code is correct. This is the same code that JR is using in his tool. However, you can't just assume the dimensions are 20x20. You actually have to check. The image is "off" because the dimensions are off.
this.importIcon("myIcon");
myIcon = util.iconStreamFromIcon(this.getIcon("myIcon"));
var width = myIcon.width;
var height = myIcon.height;
You can do all this from the console widow using any open document. Unless you are creating an automation script, there is no need to make the new document.
Copy link to clipboard
Copied
Hmm, myIcon.width and myIcon.height return 40 but the image is really 20 x 20 pixels. When I try specifying a width and height of 40 in oIcon I get:
GeneralError: Operation failed.
App.addToolButton:1898:Folder-Level:App:config.js
Copy link to clipboard
Copied
toolbar icons are 20x20 or less. That's why you see the error. If the conversion is saying the image is 40x40 pixels then that's what it is. You may be seeing the 20x20 in a different parameter this isn't real pixels, such as points. Edit the image in a tool that will allow you to resize it in true pixels.
Copy link to clipboard
Copied
It's definitely already 20 x 20 pixels which is why I'm confused.
Copy link to clipboard
Copied
I warned you, didn't I?
Actually, I don't think the issue is with the image size. It's with the format.
I had encountered similar issues when I messed around with these icons and finally I had to write a Java application that converts PNG images to an ARGB hex-string. But they come out rotated and flipped, so I have to rotate and flip them the other way in advance for them to come out correctly. It's a total nightmare...
Here's the hex-string I generated for your image:
"FFFFFFFFFFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFFFFFFFFFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFFFFFFFFFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFA30000FFFFFFFF"
Copy link to clipboard
Copied
I just tried the hex string you generated and it displays correctly. How did you generate that hex string?
Copy link to clipboard
Copied
Using a specialized tool in Java I created which converts normal PNGs to ARGB and outputs the result as a hex string.
Copy link to clipboard
Copied
I just converted you PNG file with my own toolbar builder tool, which you can download from my site. This tool is a PDF document and the conversion is done with Acrobat JavaScript. It had no problems, but I'm on Windows, and you saying this icon on a Mac converts to 40x40 using Acrobat JavaScript? If true, then it is a bug.
Here's my result:
var strIconData = "00000000ff8a1400ff96101bff850300ffc20e17ff9f0500ffa30d00ff990400ff930401ffa20b10ff9e0704ffa10904ffa20502ff980400ff9a0e04ff910500ffaf111cff8d0300ffa2160000000000ff941e00ff7a0400ff940d18ffad1727ffa40500ffbd0b09ff970400ffa40f02ff980406ff9e080bff9e0806ff910400ffa00500ffa80b06ff8f0400ff950900ff970404ffbb1d29ff7d0200ff9d260aff830300ffb0282d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff8f1a0bff920400ff961011ff83030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff820d00ff960500ffae0506ffa7050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff9e0b0bffa90506ffaa0501ffb5090b000000000000000000000000ff4c2c21ff6e1516ff650d0dff6e1323ff600a18ff6d2226ff5c1214ff6a1b22ff702028ff461e19000000000000000000000000ff8d0300ff9f0500ffa90d09ff9f0500000000000000000000000000ff4f1914ff7a1e1bff771b18ff6e1e24ff580a0eff6b1717ff72191aff75151dff6f0f19ff511e1c000000000000000000000000ffa20500ffad0f06ff9f0500ff9f050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffa70804ff960400ffa00702ff9b040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffa20800ffa30600ff9c0400ffa30a06000000000000000000000000ff58241fff5c2215ff5b2013ff47160eff63322bff601c13ff5f1610ff651919ff65171dff4a181b000000000000000000000000ffa20800ffa30600ff9d0500ffa50c00000000000000000000000000ff542717ff60220cff681b09ff6c1a10ff761d16ff6c1203ff72170aff5c140aff632820ff582921000000000000000000000000ffa70502ffa50501ffa10900ff9c040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffa70502ffa50501ffaf0603ffaa060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff9e0704ffa10600ffab0600ffb30607000000000000000000000000ff4f2822ff5d2215ff631d13ff641916ff6c201dff63170eff5f120aff61312b0000000000000000000000000000000000000000ff9e0704ffa10600ffa10500ffa80806000000000000000000000000ff631c22ff6e1914ff6d1712ff752522ff661613ff660f08ff6a150dff6126230000000000000000000000000000000000000000ff9d0a01ffa50600ffa50504ffa0050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff9d0a01ffa50600ffa6101fff90030900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff8a0211ff9e050fff8c0305ffb71f3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff991120ff9b030dff931608ff740200ff991606ff8d0300ffaf0a02ffa40500ffa40505ffa90d0cff9f0706ff9f0706ffa80500ffa80500ffa40700ffa10800ff9e0704ff9e0704ff9a0400ffac1313ff7a0200ffac182000000000ffa32519ff920f00ff9c0d00ffaf0a02ff9f0500ffa80608ff950400ff9e0605ff9e0605ffa70500ffa70500ffa30500ffa00600ff9e0703ff9e0604ffa10a06ff9d0504ffb0181d00000000";
var oIconStream = {count:0, width:20, height:20,
read:function(nBytes){return strIconData.slice(this.count,this.count+=2*nBytes)}};
// Action Script
var cButtJS = "app.alert('Hello Image Button',2)";
// Create Toolbar Button
app.addToolButton({cName:"TEst1", oIcon:oIconStream, cExec:cButtJS});
Copy link to clipboard
Copied
Your hex string worked fine for me. I'm able to generate valid hex strings that display the icon correctly on Windows but not on Mac. I'm just going to assume this is a Mac bug and generate my hex strings on Windows and paste into Mac.
Copy link to clipboard
Copied
To easily get the hex string for any image, you can use my free Manage Icons 2.0 tool.
http://practicalpdf.com/actions-and-commands/
Use any PDF file to import the image as an icon using pPDF:Import Icon, then use pPDF Manage Icons to see list the icons in the document, then either "Get Hex" to get just the hex string or "Get Code" to get a JavaScript snippet that you can use in the rest of your code.
See that page for sample files and installation instructions.
Copy link to clipboard
Copied
I tried your tool but the Import Icon command only allowed me to select .pdf files (not my .png).
Copy link to clipboard
Copied
Your hex string worked fine for me. I'm able to generate valid hex strings that display the icon correctly on Windows but not on Mac. I'm just going to assume this is a Mac bug and generate my hex strings on Windows and paste into Mac. Thanks for the help.
Copy link to clipboard
Copied
I've never had an issue with Acrobat converting the image size incorrectly. I'd like to see if I have this same issue. Can you send me your png? Send it too support@pdfscripting.com
Copy link to clipboard
Copied
I tried emailing the icon to the email address you supplied but I'm getting the following error:
[personal information removed per policy - https://forums.adobe.com/docs/DOC-3731]
[This is an open forum, not Adobe support, please do not post personal information]
[If you are posting using email, please turn your 'sig file' function OFF for posting]
[WARNING - Adobe does not use Skype, so BEWARE of someone contacting you via Skype and claiming to be from Adobe]
No such user here (in reply to RCPT TO
command)
Is this the correct address?
Copy link to clipboard
Copied
cschmelter Just message me on this site. Put the cursor over my name and click on the Message button.
Copy link to clipboard
Copied
It's definitely already 20 x 20 pixels which is why I'm confused.
About Apple Preview, aka "PDF Killer":
Copy link to clipboard
Copied
Thanks for the links but the first one doesn't apply since I'm dealing with a PNG, not a PDF in Preview.
Copy link to clipboard
Copied
Here is a screen shot of Acrobat that shows the icon hex PDF generator tool and how after I select the file it loads it in fine and then on the Quick Tools toolbar you can see the red icon does not display correctly.
Copy link to clipboard
Copied
you can see the red icon does not display correctly.
You must create and design icons at their final size: 20 x 20 pixels.
Otherwise, pixels are downsampled to fit this size, causing blurring and aliasing.
Copy link to clipboard
Copied
Here is the source JS file: https://adobe.ly/2q1y84S
of this free tool: https://www.abracadabrapdf.net/?p=964
which use one of above icons.