Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
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

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
3.6K
Translate
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
Translate
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

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.

Translate
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

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

Translate
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

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

Translate
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

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

Translate
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

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?

Translate
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

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

Translate
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

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!

Translate
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

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

Translate
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

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

Translate
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
New Here ,
Jan 19, 2025 Jan 19, 2025

Hi,

I know it is an old thread, but I tried to create an export option useable in Reader. I put this script in the privileged Folder:

 

myExportFunc = app.trustedFunction(function(eDoc,ePath)
{
app.beginPriv();
eDoc.exportAsFDF({cPath:ePath});
app.endPriv();
});

 

and called it with

 

var thepath = "/C/Users/Me/Desktop/example.fdf";

myExportFunc(this,thepath);

 

It works fine in Pro version but Reader does nothing. Am I missing something?

Translate
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
Adobe Employee ,
Jan 22, 2025 Jan 22, 2025
LATEST

Hi @Jovado,

 

Hope you are doing well. Sorry for the trouble. 

 

Let me brief you on the issue here, and a possible solution:

 

  • exportAsFDF is Restricted in Reader: This method is part of Acrobat's extended features, which are not available in Reader by default.
  • Trusted Functions Still Require Permissions: Even if the script is in a privileged location, the operation itself (exporting an FDF) is disabled in Reader unless the document includes special rights.

 

You can try the below steps:

  • To allow Adobe Reader to perform advanced operations like exportAsFDF, the PDF must be "Reader-enabled."
  • Use Acrobat Pro to add Reader Extensions:
    1. Open the PDF in Acrobat Pro.
    2. Go to File > Save As Other > Reader Extended PDF > Enable More Tools (includes form fill-in & save).
    3. Save the file and test your script in Reader.

Note: Reader Extensions are limited in scope and may not enable all Pro features. For full functionality, a server-based solution like Adobe LiveCycle (AEM Forms) might be needed.

 

 

Hope this helps.


-Souvik

Translate
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