Copy link to clipboard
Copied
Let me start with, I have absolutely no clue what I'm doing lol. Maybe Acrobat is not the best place to do this, I'm not sure (if you have recommendations, please feel free to comment!). I have scoured the internet to find a solution and cannot find it (though I also don't know what I'm looking for lol).
My goal is to use javascript (or if there is some other way that is easier, please shout it out) to automate a specific process. When I check a checkbox, I want the text in a text field of the current pdf (doc 1) to automatically be placed in a specific text field of a different pdf (doc 2). This will save me a loooooad of time if I can figure this out and implement multiple of these processes (I also have to figure out a way not to overload the system with this, if it will overload it).
Thank you!!
There are complete details about one of the ways to do this in the following thread from a couple days ago. This uses a button field but you can easily put the script in a check box.
Like I said in the previous post, there are several ways to create this functionality.
Here's one way.
1) Open both documents so they can be prepared.
2) Add this line of code to a document script in the Target PDF.
this.disclosed = true;
3) The target PDF has to be identified by the source PDF. There are lots of ways to do this, but one simple way is to set the document "subject" property to a specific value. For the purposes of this demo, make it "Target".
Open up the document pro
...Copy link to clipboard
Copied
Yes, this is possible. There are various ways data transfers can be made between PDF documents using Acrobat. And you are correct, JavaScript is needed for the functionality you've described.
Two simple methodologies are to
1) Have both documents open at the same time. The target document must be diclosed. Disclosure allows a script in the source document to access the target document for setting a field value.
2) Make the target document an attachment to the source document. The source document can open and write to it's own attachments, but only in Acrobat Pro.
You can read about form scripting and data handling here:
https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm
https://www.pdfscripting.com/public/Form-Data-Handling.cfm
Copy link to clipboard
Copied
I have reviewed the website information you provided repeatedly and can't seem to figure it out. I have managed to link the destination pdf to the source pdf, however, nothing else is working code-wise for me. Wondering if you can send me a code for this (if you have enough information)? Also, where do I input the code, do I make a new action for this? Is it document level or in the action properties of the specific field?
Copy link to clipboard
Copied
Like I said in the previous post, there are several ways to create this functionality.
Here's one way.
1) Open both documents so they can be prepared.
2) Add this line of code to a document script in the Target PDF.
this.disclosed = true;
3) The target PDF has to be identified by the source PDF. There are lots of ways to do this, but one simple way is to set the document "subject" property to a specific value. For the purposes of this demo, make it "Target".
Open up the document properties on the target PDF and make set the subject field to the word "Target".
3) In the Source PDF, Add this code to the checkbox that will write data into the target pdf
// first find the target document. This could be placed in a document level function.
var oTgtDoc = null;
for(var i=0;i<app.activeDocs.length;i++)
{
if(app.activeDocs[i].subject == "Target")
{
oTgtDoc = app.activeDocs[i];
break;
}
}
// Next, set the text field in the target document
if(oTgtDoc)
{
if(event.target.value == "Off")
{// Set the unchecked value of the field
oTgtDoc.getField("TextField1").value = "Off Value";
}
else
{// Set the checked value of the field
oTgtDoc.getField("TextField1").value = "On Value";
}
}
That's the basics. It can get a lot more complicated.
Copy link to clipboard
Copied
There are complete details about one of the ways to do this in the following thread from a couple days ago. This uses a button field but you can easily put the script in a check box.