Skip to main content
Participant
February 16, 2016
Question

Function ImportIcon with URL

  • February 16, 2016
  • 2 replies
  • 848 views

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!

This topic has been closed for replies.

2 replies

Participant
February 16, 2016

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!

Legend
February 16, 2016

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.

Legend
February 16, 2016

This method takes a DIPath. A DIPath does not take a protocol, it describes a local file.

Participant
February 16, 2016

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:

Legend
February 16, 2016

‌The UI is doing things the runtime engine will not. A DIPath cannot represent a URL.