How to Javascript a function to add a file attachment from string
Copy link to clipboard
Copied
Hi Community,
we are developing a PDF with from fields and having "NotAllowed" exception with method setDataObjectContents actual in Adobe Acrobat Reader. The goal is to read the form data as string and put it as file attachment into the attachment list of the same PDF.
Is there a way to script this without running into security issues using actual Adobe Acrobat Reader?
Many Thx's in advance!
Copy link to clipboard
Copied
in the future, to find the best place to post your message, use the list here, https://community.adobe.com/
p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post if it helps you get responses.
<moved from using the community>
Copy link to clipboard
Copied
You can use setDataObjectContents in Acrobat Reader when the PDF file has attachments rights.
Or use Adobe Acrobat Pro or Standard.
Copy link to clipboard
Copied
Thanks for your information! That's the question, how to give the PDF file attachments rights?
I did not found any option in the Acrobat Pro to set or Acrobat Reader.
Copy link to clipboard
Copied
You can add the rights with this:
Copy link to clipboard
Copied
Some background may help understand this restriction and solution.
1. Adobe's hope and intention is to sell Acrobat. Not just to developers/creators, but to everyone. (If all your users pay for Acrobat, they can do this thing).
2. Many, many functions in the JavaScript API are limited to Acrobat only, and there is no choice. In other cases, "Reader extensions" exist. The JavaScript API includes this information for each method through the "quick bar".
3. Reader extensions is a strange name. It actually converts regular PDF into "extended" PDF, using a private signature. If the PDF has the signature, it unlocks specific functions in Reader.
4. Understand that Reader extensions mean Adobe sell less copies of Acrobat, and lose money. Therefore they look to replace the revenue, by charging for the Reader extensions.
5. In some cases the Reader extensions can be added with Acrobat. In some other cases, the need for Reader extensions has been removed. But in other important cases, Adobe charge substantially to add the extensions. Pricing is by negotiation, but it may well be cheaper to buy Acrobat for each user, if there are only a few hundred users.

