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

Auto fill

Community Beginner ,
Jul 24, 2023 Jul 24, 2023

I have 2,000 pdf documents (same layout, different clients' names), I want to import data from the old pdf files to new pdf files that have different layouts but the same information).

A workaround I tried is that I went to the new pdf template and used the same values of the old one. so when I export one pdf file, I go to the new pdf file and click import. But is there a way to auto fill using a script? I can't just keep doing the same steps for the other 1,999 file

TOPICS
Edit and convert PDFs , JavaScript , PDF , PDF forms
1.0K
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 ,
Jul 24, 2023 Jul 24, 2023

Yes, this can be done with an Action Script using the doc.exportAsFDF() and doc.importAnFDF() functions.  

Here are the steps

1. Export Data from the current to an FDF file to a temporary name and location.

2.Open the new blank form.

3. Import the FDF file.

4. Save the new form to a new name.

5. Close the new form. 

 

 

 

 

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 ,
Jul 24, 2023 Jul 24, 2023

and just do that for 1,999 forms, 1,999 times? isn;t there a script that helps bulk import?

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 ,
Jul 24, 2023 Jul 24, 2023

You missed the part where I said this was an Action Script. An Acrobat Action runs a set of commands against an entire folder of files.  

Look at the "Action Wizard".

 

 

 

 

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 ,
Jul 25, 2023 Jul 25, 2023

Are the old files located in the same folder as the new ones? If so, is there are relation between their names (something like "file1.pdf" and "file1_new.pdf")? Or do they have the same names, but are located in different folders? Or something else?

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 ,
Jul 25, 2023 Jul 25, 2023

I want to bulk export the files so I can bulk import them.

They are in different folders. Each folder and file has a client's name.

I have received a new blank pdf file, and I want to put the same information from the previous files on it.
Ex: Sam_Smith_application.pdf has to be exported to the new pdf file that is blank and has fields to fill out with the same information; this new file has a different layout and values, but all fields can be filled up using information from Sam_Smith_application.pdf. Now I have to transfer 1,999 clients' data (information) to the new pdf template. This will result in 1,999 pdf files, each containing information about a specific client.

I went to Sam_Smith_application.pdf and clicked prepare the form; then I clicked on the field that shows "Client's birthday" to get to "Text Field Properties" Then in general, I copied the name and went to the new pdf template and pasted the name of the text field in it, so when I import data, the birthday of the client can be imported. I did that for all the fields so they can match and so the data can be imported. However, it would be nice if I can just automate the export/import process instead of doing it manually.
Thank you for your help!

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 ,
Jul 25, 2023 Jul 25, 2023

Ahh, new information.  The folder structure would have been helpful up front.     

There are several ways to automate a process in Acrobat. The four common methods are Actions, JavaScript, plug-ins, and IAC.  An Action operates on the folders and files you select. But this is not suitable for the 2 tiered structure you've described. The JavaScript model does not provide direct file system access, so there is no way for a script to scan the folders to find the appropiate files. A plug-in is over kill for this and requires real programming skills and tools. So, the IAC is your best choice for a simple fully automated solution.  Are you familiar with Visual Basic? If not. I'd suggest you hire a developer. 

 

 

 

 

 

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 ,
Jul 25, 2023 Jul 25, 2023

If the files are named the same (and the fields in them are named the same, too, of course) in all folders then you can easily do it using two Actions: One to export the form data, and another to import it.

The code for both is very simple. For the former it's this:

 

this.exportAsFDF({cPath: this.path.replace(".pdf", ".fdf")});

 

For the latter:

 

this.importAnFDF({cPath: this.path.replace(".pdf", ".fdf")});

 

After running the Export Action just copy (or move) all the FDF files that were generated in the first folder to the second one, then run the Import Action on the files in that folder, and you're done!

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 ,
Jul 25, 2023 Jul 25, 2023

Gilad, are you saying that the Action will process files in sub-folders?

There is also no reason to create a second actions. The new form can be created immediately after the export. 

 

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 ,
Jul 25, 2023 Jul 25, 2023

I thought the folders were separate, but actually it will. If you select a folder as the input it will also process all files in the sub-folders of the selected one.

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 ,
Jul 25, 2023 Jul 25, 2023
LATEST

Very good to know. I've never used it that way.

Well then, my original solution works fine. Lots of unnecessary discussion here. 

 

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