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

Export or copy to values to other pdf

New Here ,
Mar 22, 2018 Mar 22, 2018

Copy link to clipboard

Copied

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.

TOPICS
Acrobat SDK and JavaScript

Views

271

Translate

Translate

Report

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 ,
Mar 22, 2018 Mar 22, 2018

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

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 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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 ,
Mar 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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 ,
Mar 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

There's no JS Console in the Reader, isn't it ?

There is one, but it's hidden.

- Go to Preferences : JavaScript to enable "Show Console on errors and messages".

- Install this free tool to add a button that show the Console in Reader: https://abracadabrapdf.net/download/JSDebugger_button.js.zip

(Sorry Thom, I cannot find the original link…)

Votes

Translate

Translate

Report

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 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

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 ?

Votes

Translate

Translate

Report

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 ,
Mar 29, 2018 Mar 29, 2018

Copy link to clipboard

Copied

LATEST

Can you post the full code?

Votes

Translate

Translate

Report

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