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

Setting up buttons to export FDF data then import FDF data onto a different form for Reader users

Community Beginner ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Hi, 

So I an not a programmer the best that I can do is copy/paste javascript that I've searched for on these forums. 

 

I have a copy of Adobe acrobat pro DC to create forms but the rest of my team does not. I am trying to export form data (FDF) from one PDF (PDF#1) and then import that data into a second form (PDF#2). Since the rest of my team does not have pro verions I am trying to set up a button to export the FDF from PDF#1 and then importing that FDF file into PDF#2. Theses are fillable forms that will have a different names/ values each time. 

 

First I tried creating a button that did this 

exportAsFDF();

which worked for my version of adobe but the button did nothign for non pro users. 

 

Non pro users can email out an FDF file but I only know how to do that with an export out button (Mouse up > Submit a form). The problem is that I will have to direct  the the eport to a specific email address. This will not work because we need each person to be able to deal with their own form data and we don't have a shared email account. We do heave a OneDrive but its behind a password so everytime I try to export to that I end up generating a PDF of the log in  screen for OneDrive (even while logged in on the browser).  Does anyone know of a Javascript that will allow a non pro user to export out FDF to a mailbox of their choice?  

 

The next issue is importing the FDF from PDF#1 into PDF#2.  The import button feature Mouse Up > Import form data  requires you to select a specific file containing form data. This will not work because the form data file will change names each time and can't be directed to a specific location on my desktop. Is there a script out there that will allow a non DC pro user import an FDF file from a location of their choosing? 

 

I really appreciate any hep or tips i've been searching replies for days. I feel like the submit for review/ editing feature could be the answer but I don't know that non pro users will be able to utilize that feature. 

 

Thanks!

K

TOPICS
Create PDFs , Edit and convert PDFs , How to , PDF forms

Views

1.8K

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
Contributor ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

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 Beginner ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Wouldn't this still require me to open all of the response files and manipulate them? I need my team to transfer data from one pdf to another with their reader version of adobe without me.

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 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Unfortunately, Reader does not allow the export of data without special "Reader Rights". But reader can load data from an FDF.  And if it is done from a privileged script, then there is no problem. 

 

However, what a script in Reader can do is open two PDFs and copy data from one to the other. Would this work for you?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Yes! I didn't know that was an option!

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 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

There are a few different ways of doing this.

1) Copy all the data from one form into the global object, then a script can copy it into any open document. This is good when the data from on form goes to many.

There are paid for scripts for this here:

https://www.pdfscripting.com/public/Form-Data-PreFill-Tool.cfm

 

2) Just use the two open documents. Copy data from the current (front) PDF into the other one. 

Use a loop to go through all the fields on the form

 

var oOtherDoc = (app.activeDocs[0]==this)?app.activeDocs[1]:app.activeDocs[0];

for(var i=0;i<this.numFields;i++)

     var oFld1 = this.getField(this.getNthFieldName(i));

     var oFld2 = oOtherDoc.getField(this.getNthFieldName(i));

      if(oFld2 && (oFld1.type != "button"))

               oFld1.value  = oFld2.value;

}

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Mar 27, 2020 Mar 27, 2020

Copy link to clipboard

Copied

Thank you very much for your reply! Could you break apart what these steps are please? Since in only have about 20 or so fields that I want to copy over is there a way to cal out each field by name to copy form one document to the other?

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 27, 2020 Mar 27, 2020

Copy link to clipboard

Copied

The script I provided above works on two forms open in Acrobat.  It copies values on all the fields from the back document to the front document. It's not necessary to list field names.

 

But If you wanted to do that, then only a simple modification is needed.

 

var oOtherDoc = (app.activeDocs[0]==this)?app.activeDocs[1]:app.activeDocs[0];

var aFldNames = ["A", "B", "C"];  

for(var i=0;i<aFldNames.length;i++)

     var oFld1 = this.getField(aFldNames[i]);

     var oFld2 = oOtherDoc.getField(aFldNames[i]);

      if(oFld2 && oFld1)

               oFld1.value  = oFld2.value;

}

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 Beginner ,
Mar 27, 2020 Mar 27, 2020

Copy link to clipboard

Copied

Thanks again for your reply! If the field names are not required I don't want to make things more complicated. 

 

I tried copying in your first scrip into my button in mosue up run a javascript but it doens't do anyting. Do I need to designate which form is the fron and which is the back? 

 

Thanks!

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 27, 2020 Mar 27, 2020

Copy link to clipboard

Copied

This code cannot be run from a button on the form. It has to be run from either the console window, or placed in a trusted folder level function. 

 

I would suggest running it from the console window.

Watch the console window tutorial here:

https://www.pdfscripting.com/public/Free_Videos.cfm#JSIntro

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

LATEST

How sad, we can’t use it for a button. I’m in need of a way to do that using Reader.

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