Skip to main content
Inspiring
November 2, 2023
Question

Button to export fields from forms PDF1 to PDF2

  • November 2, 2023
  • 4 replies
  • 2707 views

Hello helpful people!

 

I need to create a script for a button that will export certain field data from PDF Form 1 to the exactly named fields on PDF Form 2.  It needs to be a button as overly complicated instructions go over like lead balloons.  Thanks all!

This topic has been closed for replies.

4 replies

JR Boulay
Community Expert
Community Expert
November 3, 2023

You can install it in the quick toolbar.

 

Acrobate du PDF, InDesigner et Photoshopographe
JR Boulay
Community Expert
Community Expert
November 3, 2023

The easiest way is to use data export/import.

 

 

 

Acrobate du PDF, InDesigner et Photoshopographe
Amal.
Community Manager
Community Manager
November 2, 2023

Hi @Leah31805381ekx5 

Hope you are doing well and thanks for reaching out.

The workflow you are trying to achieve is might be possible using JavaScript. For more information please check the help pages listed below:
https://acrobatusers.com/tutorials/javascript_console/ 
https://helpx.adobe.com/acrobat/using/applying-actions-scripts-pdfs.html

Hope it will help

Regards
Amal

Known Participant
November 2, 2023

@Amal. I am not a coder therefore neither of those help very much.  They are like reading a foreign language.

try67
Community Expert
Community Expert
November 2, 2023

The easiest way to do that is to save the date to a global variable when exporting, and then copy it back to the field with the same name when importing.

The basic code can be something like this:

 

// Export script

if (global.myData==null) global.myData = {};

global.myData["Text1"] = this.getField("Text1").valueAsString;

 

// Import script

if (global.myData==null) app.alert("No global data was found.");

else this.getField("Text1").value = global.myData["Text1"];

Known Participant
November 2, 2023

@try67  Thank you.

I input the following code on a button in Form 1:

// Export script

if (global.myData==null) global.myData = {};
global.myData["CrtAuditPeriod"] = this.getField("CrtAuditPeriod").valueAsString;

 

And the below code on a button in Form 2:

// Import script

if (global.myData==null) app.alert("No global data was found.");
else this.getField("CrtAuditPeriod").value = global.myData["CrtAuditPeriod"];

 

Unfortunately it did not work.  Any more tips?

try67
Community Expert
Community Expert
November 2, 2023

No, you need to better explain what "did not work" means, exactly. Did it copy something at all? If not, was there an error message? If so, what did it say? etc.