Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Making HTTP request in the PDF

Community Beginner ,
Jun 07, 2021 Jun 07, 2021

Hello there, 

 

I am trying to make a pdf button where i can click on it , retrieve the data from the server , fill a dropdown list from there.

The code : 

Net.HTTP.request({
cVerb: "GET",
cURL: "http://newits.devs/getContacts.php",
oHandler:{
response: function(msg,uri,e,h){
    app.alert(msg);
}
}
});


But i am getting an error after i click it : 

NotAllowedError: Security settings prevent access to this property or method.

 

TOPICS
Create PDFs , JavaScript
9.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jun 07, 2021 Jun 07, 2021

At folder level you must define the function. At the button use / call the function.

 

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2021 Jun 07, 2021

Use a trusted function for this.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 07, 2021 Jun 07, 2021

Can you please direct me to a resource on how to use it ? 
Or Maybe you can tell me what should i add in the above code so it's using a trusted function ? 

Thanks in advance.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2021 Jun 07, 2021

https://acrobatusers.com/tutorials/using_trusted_functions/ 

Look also at Acrobat Javascript Reference.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 07, 2021 Jun 07, 2021

Thanks a lot 

 

But it only works on startup (folder level script ) not on button click, still giving me the same error message.

The documentation says that it can work on "trusted documents" .

How can i make my document trusted ? i really searched a lot and haven't find any.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2021 Jun 07, 2021

Have you created a trusted function? And does you use this function at the button?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 07, 2021 Jun 07, 2021

I did create the trusted function and put it on the action when the button clicks , but it still gives me 

NotAllowedError: Security settings prevent access to this property or method.

it works fine though as a folder level script

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 07, 2021 Jun 07, 2021

At folder level you must define the function. At the button use / call the function.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 08, 2021 Jun 08, 2021

Thanks a lot Bernd,I really appreciate your help and support.

 

Yes this works as well, it's very unfortunate though that there is no way that the document itself can't have trusted functions without depending on folder level scripts.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 08, 2021 Jun 08, 2021

Trusted functions in the document makes no sense.

For security reason trusted functions must be defined at folder level.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 08, 2021 Jun 08, 2021

I have one followup question...could this application not even work on google docs then?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 08, 2021 Jun 08, 2021

Try a forum for Google Docs.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 08, 2021 Jun 08, 2021

the problem would be with adobe not google docs...but if you say it is a file level...it should work right?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 08, 2021 Jun 08, 2021

What is the problem?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 08, 2021 Jun 08, 2021

please read above...when I say "problem" I mean the restraint is with adobe.  You say that trusted documents must be on a file level.  So I am asking if we can use google docs then for those files....it is a file/folder level.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 08, 2021 Jun 08, 2021

No. You must use a js-file at one of the two Javascript folders. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 08, 2023 Mar 08, 2023

Hi Bernd. I'm in the same situation than Joanna. I've read numbers post over internet and i cant make Net.HTTP.request works on acrobat reader (11 or dc). Allways "NotAllowedError" error. The code is in Config.js in acrobat javascript folder, and attach to a menu.

It works well on PRO but not on Reader. Do you have an idea ???

My goal was to send the PDF modified by user on a http server.

 

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 08, 2023 Mar 08, 2023

Do NOT edit config.js. Restore it exactly and then create a new startup JS file in the user startup folder. But that won't make it work in Pro. The quick bart shows an F in box 4, meaning you need "forms rights". These can ONLY be granted by AEM software, POA, expect 5-6 figure license fees. Generally it will be cheaper to license Acrobat for each user, or give up on the idea of using this method. Consider using the existing SUBMIT mechanism, which is available in Reader and without startup scripts.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 08, 2023 Mar 08, 2023

I can make it work with "submitform" but my goal is to make it transparent for users. If i use "submitform" i alwways have to click on a message box (status variable). I just want that users click on a button and nothing else.

I think adobe has "blocked" Net.HTTP.request on READER to make user buy Pro version

 

Thanks for your help

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 08, 2023 Mar 08, 2023
LATEST

"I think adobe has "blocked" Net.HTTP.request on READER to make user buy Pro version"

Yes, of course. That's why Reader exists - to create an appetite for paid-for features. Adobe's aim is to sell it everyone, not just creators. But, for the price of a few hundred licenses, AEM enabling is an alternative for a very few paths. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines