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

Possible to: Copy/Paste all javascript (& xml) from one pdf to another?

Participant ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

I have a suite of similar forms that require updates periodically. They have scripts for field actions as well as calculation and validation scripts. 

 

What is the best-practice here? I'd like to avoid manually copying the field action scripts into each field. The solution in my mind SHOULD BE a single javascript code pasted in a single place. i.e. in All Javascripts.

 

I've tried copy/pasting all scripts from the All Javascripts / JavaScript Editor into that of a new file, which has the same field names. However, nothing happens. 

 

I've attempted using Organize Pages to replace the file with javascripts with an updated file (from InDesign). But that doesn't work either: Acrobat chops up the design of both documents and distributes the elements (seemingly) randomly as layers, while also not including new/different design elements. 

 

I've also attempted to write all javascripts into a single hidden calculation field. My java experience is limited, but already I question whether this would be best-practice anyway. 

 

Any recommendations are appreciated.

 

TOPICS
JavaScript , PDF forms

Views

514

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 ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Hi,

 

you should be able to use the All JavaScript to be able to copy, I have done it a number of times, exactly what is or is not happening when you do that?

 

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
Participant ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

I copy/paste the entire All JavaScript into a new file. No changes apply to the new document and the entire paste is cleared from All JavaScripts upon re-opening.

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 ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Hi,

 

Does the new file have the exact same field names ( and all of them ) I spotted an issue where the javascript is not copied if it has a field that doesn't exist in the document.

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
Participant ,
Aug 04, 2022 Aug 04, 2022

Copy link to clipboard

Copied

Exact field names (and all of them) : check. 

 

I'm very pleased to hear it is possible, even if I have no success in this instance. It is possible that something other than field name was changed on the old pdf (i.e. a drop down option, other field attribute) that is disallowing the copy. 

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 ,
Aug 08, 2022 Aug 08, 2022

Copy link to clipboard

Copied

LATEST

Hi,

The only thing I can think of doing is trying to copy specific parts of the file at a time, until you find a piece that does not copy and then we can investigate that code for why it is failing?

 

If you are able to share the documents we would be able to help with that.

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