Skip to main content
Known Participant
August 2, 2022
Question

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

  • August 2, 2022
  • 1 reply
  • 1424 views

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.

 

This topic has been closed for replies.

1 reply

BarlaeDC
Community Expert
Community Expert
August 3, 2022

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?

 

dankpoochAuthor
Known Participant
August 3, 2022

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.

BarlaeDC
Community Expert
Community Expert
August 4, 2022

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.