Copy link to clipboard
Copied
Hello! I have a problem with the function ImportIcon, in order to insert a PDF into a button.
My code is the following:
app.beginPriv(); // Explicitly raise privilege
this.importIcon("myIcon", Path, 0);
app.alert(Path);
app.endPriv();
It works perfectly when I use a path from my disk, but we are trying to add PDF from a URL and then our problems begin. For example, we are trying with this URL with a PDF sample and we are not able to add it inside the button: http://www.orimi.com/pdf-test.pdf
I don't know if there is any way to escape that URL to treat it like a Path, or some function to get it.
Thanks a lot!
Copy link to clipboard
Copied
This method takes a DIPath. A DIPath does not take a protocol, it describes a local file.
Copy link to clipboard
Copied
Thanks for the answer. So there is no way to convert the URL to a Path in order to apply that PDF of the link to the icon?
If I enter in the Properties of the button, and in the window "Options", clicking "Choose Icon", if I put directly the URL Acrobat is able to download the link and put it inside the icon. I don't know how to do that with Javascript:
Copy link to clipboard
Copied
The UI is doing things the runtime engine will not. A DIPath cannot represent a URL.
Copy link to clipboard
Copied
Thanks a lot for your help and answer.
So there is no other way to load an image/pdf from a URL to embed it into a button?
Thanks!
Copy link to clipboard
Copied
I never heard of such a thing. But I admit I am surprised that you can do it in the UI.
But an important point about JavaScript is that it is a parallel environment to the UI. In many apps, scripting is a way to directly control menus and dialog options, but in Acrobat it is a different set of facilities.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now