Skip to main content
cayqw
Participant
December 6, 2016
Question

what are the specific set of steps involved in order to allow a javascript call to the Net.Http.request method?

  • December 6, 2016
  • 5 replies
  • 3789 views

I am trying to send a document to a SaaS.  The documentation for the Net.Http.request function indicates that you can just call it

like a normal function so after reading documentation and trying to build a proof of concept based on it, I got the following error:


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

What are the specific set of steps involved in order to allow a javascript call to the Net.Http.request method?

This topic has been closed for replies.

5 replies

catsgotmytongue
Participating Frequently
December 15, 2016

Is there a way from a javascript extension script to submit the entire pdf file (I'm thinking a byte[] - meaning the entire set of bytes that make up the pdf) to another process on the same machine or post to a server(form submit)?

I've explored the "save"/"Save As" route as described here: https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript

That won't work, I need a way to grab the entire byte contents of the file and submit it from a javascript extension script running in acrobat. The end goal being to post to a form url or a RESTful Api interface.

The whole reason this forum post was started was I discovered through trial and error and javascript api documentation that I couldn't use the Net.HTTP.request (discussed above) without specific rights to the document (also discussed previously) and a priviledged context.

I would like to know if it is possible within a javascript extension script, if the script can grab the file itself as a binary/byte[](note that this is not the form with in the file but the entire file) in order to send the bytes to another process or server.

Joel Geraci
Community Expert
Community Expert
December 15, 2016

The normal submit action in Acrobat and now Reader can submit the entire file to a server, you don't need any special permissions. The only thing that's a bit odd is that the PDF is the body of the message, there's no multipart anything. You then just write the bytes to disk and you have a PDF on your server or you can ship it off to other RESTful APIs.

If you need to communicate back to the PDF, you do that via FDF or XFDF. Most RESTful APIs don't return FDF or XFDF so you'll need to massage the response into something Acrobat will like and send that back. It's far easier than it sounds, just think of your server as an intermediary between the PDF and the API you want to leverage and you can basically do whatever you want without needing to add Reader Extensions.

catsgotmytongue
Participating Frequently
December 16, 2016

That's the first helpful answer I've seen here. Thanks. I'm new to acrobat related anything... but I'm a senior level .net developer.

Can you point me to the right documentation about this submit function or tell me where it is in acrobat's javascript API documentation ?


Here's what I'm looking at:
http://help.adobe.com/livedocs/acrobat_sdk/11/Acrobat11_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp.htm?href=JavaScript_Secti…

Legend
December 12, 2016

I would say not. To work with PDF files you can't usually use existing web APIs, you have to create ones for the format. You can SUBMIT a form to a web URL, which is a way to achieve sending. Don't expect it to work in most browsers though.

cayqw
cayqwAuthor
Participant
December 6, 2016

We looked further and now wondering, what does "forms rights" mean and how does one apply it to a specific document

using acrobat?

lrosenth
Adobe Employee
Adobe Employee
December 6, 2016

It means that you enabled special rights in your form using the Save as Rights Enabled PDF feature.

catsgotmytongue
Participating Frequently
December 7, 2016

Please elaborate on what this means, I have never developed for adobe acrobat before.

Where can I find the documentation that explains the steps involved in applying these rights to a pdf?

I find no such "Save as Rights enabled" any where in acrobat DC Pro's menus or preferences or save as dialogs the closest I find is this:

I've tried this several different ways and I cannot get the method Net.HTTP.request to execute at all with acrobat pro or reader DC or XI in my javascript extension code.

Clearly I'm doing something wrong if it won't execute that method.

However, there must be some set of circumstances or steps on how to apply these rights I'm missing. The documentation isn't very clear on this particular aspect.

Legend
December 6, 2016

Ah, found it in the document. I think you didn't check out the information in the Quick Bar and security note....

cayqw
cayqwAuthor
Participant
December 6, 2016

Thanks. We will look.

lrosenth
Adobe Employee
Adobe Employee
December 6, 2016

What documentation are you referring to? That isn’t a standard Acrobat JS method…

cayqw
cayqwAuthor
Participant
December 6, 2016

http://help.adobe.com/livedocs/acrobat_sdk/11/Acrobat11 HTML.Help/wwhelp/wwhimp/js/html/whelp.htm?href=JavaScript_SectionPage.70.1.html&accessible=true