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.
... View more