Skip to main content
Participant
January 20, 2022
Answered

How to add keys to a fillable pdf document

  • January 20, 2022
  • 3 replies
  • 1539 views

I have a pdf document from revenu canada(IRS). I need to create keys in the document so that I can fetch data from my database and use this data to fill in the form by mapping the keys to my data. Can anybody tell me how to  do this with ac reader pro?

This topic has been closed for replies.
Correct answer Thom Parker

There are a few different ways that data can be imported into a PDF. Karl has outlined two methods. One using an external app and the other a local data file to load data into form fields, but there is a much simpler mechanism that will work with both Acrobat Reader and Pro, which is to use a form submit. A submit performs an HTTP operation and expects the return data to be in a known data format. The returned data is mapped into form fields on the PDF.

To do this you'll need a server side app to get data from the DB, put it in the correct format, and return is as the HTTP response data. 

 

Here are some helpful links:

https://acrobatusers.com/tutorials/submitting-data/

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

 

Here is the Acrobat JavaScript reference entry for the submit function:

https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/html2015/index.html#t=Acro12_MasterBook%2FJS_API_AcroJS%2FDoc_methods.htm%23TOC_submitFormbc-106&rhtocid=_6_1_8_23_1_105

 

 

3 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
January 20, 2022

There are a few different ways that data can be imported into a PDF. Karl has outlined two methods. One using an external app and the other a local data file to load data into form fields, but there is a much simpler mechanism that will work with both Acrobat Reader and Pro, which is to use a form submit. A submit performs an HTTP operation and expects the return data to be in a known data format. The returned data is mapped into form fields on the PDF.

To do this you'll need a server side app to get data from the DB, put it in the correct format, and return is as the HTTP response data. 

 

Here are some helpful links:

https://acrobatusers.com/tutorials/submitting-data/

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

 

Here is the Acrobat JavaScript reference entry for the submit function:

https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/html2015/index.html#t=Acro12_MasterBook%2FJS_API_AcroJS%2FDoc_methods.htm%23TOC_submitFormbc-106&rhtocid=_6_1_8_23_1_105

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Karl Heinz  Kremer
Community Expert
Community Expert
January 20, 2022

I would question the "much simpler" 🙂 I'd rather write VBA code all day long than trying to get stuff on the web to work 🙂 

Thom Parker
Community Expert
Community Expert
January 20, 2022

Yeah, if you've got it all local, then you're set. But if it's remote anyway, well ya gotta go remote. All depends on where the data resides. 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Karl Heinz  Kremer
Community Expert
Community Expert
January 20, 2022

I don't understand what you mean by "keys". There is a way to fill in form fields with an external program using the IAC API. Here is a sample that will work in Adobe Acrobat (not the free Reader): http://khkonsulting.com/2010/09/reading-pdf-form-fields-with-vba/

 

You can also do this by importing a tab separated text file, but that gets a bit more tricky. The best way is to export data from a form first to a text file, and then modify that so that it contains your new data. You will have to make sure that the column names do not change, and that you have exactly the same amount of columns as your exported file. 

Bernd Alheit
Community Expert
Community Expert
January 20, 2022

Open the file in Adobe Acrobat. What can you see when you use Tools > Prepare Form?