Skip to main content
March 22, 2018
Question

Export or copy to values to other pdf

  • March 22, 2018
  • 3 replies
  • 438 views

Hello !

I've made a script, activated by pushing a button, to export or copy field values from one pdf to another. Everything works fine with Acrobat Pro, but it doesn't work with Acrobat Reader DC. I'v read in other posts, that it should be possible and I really can't see anything logical, that it shouldn't be possible: I know, it's called "Reader". But this reader can change field values, properties and so on in one file. And finally, the READER can SAVE CHANGES. So why shouldn't it could change values in other pdf files !? I think, I simply made a fault in my script, so I need some help, please ! Or is it really impossible !? The relevant part of my script only needs two lines, I thought. It is like this:

newDoc = app.openDoc("target.pdf");

newDoc.getField("name").value = this.getField("source_field").value;

Of course, the target pdf has the action

this.disclosed = true;

in document java Scripts. As I told: it works with Acrobat Pro.

This topic has been closed for replies.

3 replies

March 29, 2018

ok, thanks for this information !

obviously there are some properties that have to be changed. the console sends an error. It is in german, I try to translate correctly to english: "NotAllowedError: Safety properties prevent the access to this feature or method".

Does anybody know, what kind of feature or method this could be and what do I have to change ?

try67
Community Expert
Community Expert
March 29, 2018

Can you post the full code?

March 28, 2018

There's no JS Console in the Reader, isn't it ? I tested with my Acrobat Pro without any error. But at work, I only have the Reader. And with this Reader nothing happens. I'm using Acrobat Reader DC, Version 2018.011.20038

I've change to try67's code.

try67
Community Expert
Community Expert
March 28, 2018

There is, actually. Go to Edit - Preferences - JavaScript and tick the option to show it on errors and messages and then try again.

try67
Community Expert
Community Expert
March 22, 2018

When opening other files it's never a good idea to use the "this" keyword, as it's hard to predict what it will point to.

So change your code to:

var oldDoc = this;

var newDoc = app.openDoc("target.pdf");

newDoc.getField("name").value = oldDoc.getField("source_field").value;

If that still doesn't work please specify exactly what happens. Are there error messages in the JS Console?

Also, what version of Reader are you using?