Importing Data in Acrobat

Data is central to every form. Some forms simply collect data while others use pre-collected data to do various things to forms, such as pre-populate names, phone numbers, addresses, affect the layout of a form or various other things.

Using pre-collected data to affect a form as described above involves *importing* data into a form via the host application (assuming a server isn’t part of the picture). This time around, I want to talk specifically about importing data using *Acrobat*.

As you all know, Adobe distributes the “Reader”:http://www.adobe.com/products/acrobat/readermain.html application for free. Because of this, you can save the forms you design in “Designer”:http://www.adobe.com/products/server/adobedesigner as PDF and anyone with the free Reader application can fill your form and submit its data electronically.

The catch is when your PDF form requires data to be imported. Unless the host application is “Acrobat Professional”:http://www.adobe.com/products/acrobatpro or “Acrobat Standard”:http://www.adobe.com/products/acrobatpro/acrobatstd.html, a _regular_ PDF form *cannot* import data — no matter if it comes from an XML Data file or from a data connection to an ODBC or WSDL data source. Acrobat Pro/Std comes with all the tools you need to import data into a form and permits data to be automatically imported via an ODBC or WSDL connection. PDF forms opened in Reader (or “Elements”:http://www.adobe.com/products/acrobatpro/acrobatel.html for that matter), on the other hand, aren’t privy to that functionality by default — that is, Reader 7.0.7+ (the latest version is 7.0.8) doesn’t allow data import by default.

In Reader 7.0.5, there was a bug that resulted in Reader having the ability to import data into forms. Unfortunately (well, that’s my opinion), that bug was fixed in Reader 7.0.7 such that Reader can no longer, by default, import data into a PDF form.

In general (at least as of Reader 7.0.7), PDF forms opened in Reader must be individually _extended_, using Acrobat Professional or “Adobe LiveCycle Reader Extensions”:http://www.adobe.com/products/server/readerextensions, to allow the use of “hidden” functionality in Reader (such as Data Import or Commenting). (You can reader-extend forms using Acrobat Professional’s “File | Form Data | Initiate Data File Collection Workflow” menu item in order to collect data via Reader for a limited number of submissions.)

Another option is to use “Adobe LiveCycle Forms”:http://www.adobe.com/products/server/formserver to deploy your forms. Using this server product, you can pre-populate forms with data _on the server_ prior to deploying them to the client application (on the user’s system). Using this option, you don’t need to reader-extend a PDF form which imports data because the data is imported and merged into the PDF form _on the server_ and then deployed to the client application (any version of Acrobat/Reader on the user’s system), which, in turn, doesn’t need to import any data.

To summarize, here’s a little table that illustrates the conditions under which you can import data into a PDF form in Acrobat:

_|((())). *Version* |((())). *PDF Form* |((())). *With Reader Extensions* |((())). *With LiveCycle Forms* |
|((())). Reader |((())). %{color:red} *no* % |((())). yes |((())). yes |
|((())). Elements |((())). %{color:red} *no* % |((())). yes |((())). yes |
|((())). Standard |((())). yes |((())). yes |((())). yes |
|((())). Professional |((())). yes |((())). yes |((())). yes |

====
~*Updated:* September 20, 2006~

45 Responses to Importing Data in Acrobat

  1. Michael Joyce says:

    What about using ADBC?

  2. Michael,Thanks for pointing-out the use of ADBC for importing data.ADBC is specific to Acrobat Forms as opposed to XFA Forms. In this article, I was trying to address importing data in Acrobat within an XFA Form (saved as a PDF). ADBC isn’t an option in that case.

  3. Lan Pho says:

    Ok, I am still not sure how to import data. What is the structure of data file with either tab or comma delimited file needs to look like to be able to import? Is there an automated way to populate the form with 50 names?

  4. Lan,When importing data from a file into Acrobat, the data must be in an XML format.If your form is to consume the data that another application created and this data is comma-delimited, you would then have to write an XSL Transformation that, when applied to the data via a data connection created in your XFA form, would transform the comma-delimited data into an XML format that can be consumed by the form’s data model.For instance, you’re talking about populating a form with 50 names. Now I there are two obvious possibilities here: You either have 50 fields which each should get a name or you have a list field (such as a list box or a drop down list) and you would like the names to be automatically loaded into the list when the data is imported into the form in Acrobat.I’ll assume you’re talking about the latter option of populating a list field. This means that you data must have a repeating data node where each occurrence has a different value (a different name). This way, you can use the Dynamic Properties feature to create the kind of binding you’ll need to have the list field automatically populated with all the names when the data is imported into your form:<data> <name>Fred</name> <name>Wilma</name> <name>Barney</name> <name>Betty</name></data>In this sample data, the repeating data node is <name>.

  5. Rikard Isoz says:

    Hi Stefan,We have been thinking of building a web app using LifeCycle forms and asp.net. Can you give some hints on the best way to prepopulate data on the server side, as well as extract data when client post data.Best regards,Rikard

  6. Rikard,That sounds like an interesting project: LiveCycle and ASP.NET.As far as pre-populating a form with data, there are a few ways you can do that:You could have a server-side process generate data files that could then be merged into various forms using LiveCycle Forms in order to serve them out to the client application (e.g. Acrobat or a browser using HTML).You could create a data base and have your forms connect to it using an ODBC data connection.You could create an ASP.NET web service and have your forms connect to it using a WSDL data connection.I believe importing the data via an ASP.NET web service is your best option however, regardless of what you decide, you’ll unfortunately be faced with the required purchase of at least one other LiveCycle product (if you haven’t already purchased one of them): LiceCycle Reader Extensions (to enable Acrobat Reader to import data from an ODBC or WSDL data connection — unless you know users will always be using Acrobat Pro in which case you wouldn’t need Reader Extensions) or LiveCycle Forms (to import the data on the server and send the form, along with the data, in a single package to the client application).As far as extracting data submitted via a form, I strongly suggest you have a look at my colleague Steve Tibbett’s blog: SteveX. He has a few great articles on data submission via a LiveCycle form.

  7. Sérgio says:

    Hi,I would just like to add some comments to this discussion.1 – To merge that with a pdf using, for instance, asp, one could use XFD or a XDP file (the latter one only with the data part). This file could be created on server side, and be given to the client. Because this files can point to a pdf file, the client would open and merge the data onto the pdf file.2 – ADBC is just for Professional, not for Reader… at least I think so.Regards,Sérgio

  8. Lala says:

    I know there is a really easy answer to this, but, I need your help!I am the database administrator for my state. The state is still using Microsoft Access. We are now creating a static form using Adobe Professional. In the form, my boss wants me to link the database tables from Microsoft Access where when the processing assistants enter the info on the form, it automatically saves in the Microsoft Database. Is this possible. I know I can use OLEDB but what is the 1st step to get started.

  9. Lala,In your comment, you said you “are now creating a static form using Adobe Professional.”Before I go any further, I just want to make sure you’re using the Adobe Designer to design this form. This means you probably opened Acrobat Pro, went to the “Advanced | Form | Create New Form…” menu item and opted to create a new form in Adobe Designer.Is that correct?If so, then we can talk about creating a data connection to an ODBC data source and then have fields on your form bind to the nodes in the data connection in order to update data in the database in real time.

  10. malik says:

    Hello there,I am asking the same question about Microsoft Access and Adobe Designer and how to connect them to drop the fields from the table schema into the Designer.Greetings

  11. malik,Please check-out the article I just posted on Connecting a Form to a Database. Hopefully this will answer your questions as well as Lala’s.

  12. Chris Maertz says:

    Hello,I need to populate a drop-down list on a PDF form using the WSDL service. I can’t find any good information on how to bind the return data to the drop-down list, nor what I should use as a return type for the web method. Does anyone have some .NET code that show proper way to return the data. (Right now I’m returning XML as a String via a web method.) I can get the XML to show up in a form field, now I need to populate the drop-down list with the data.Thanks,Chris Maertz

  13. How about modifying your WSDL to have calls that return individual values instead of one big call that returns all the info formatted in XML? That way you wouldn’t have to parse the XML in Designer.As far as binding the return data to the drop down list, you should be able to create a new data connection to your web service and then use the new Dynamic Properties feature in 7.1 to populate the drop down list automatically.

  14. Y Gautham says:

    Hello,Im trying to retrieve data from MS-Access. While retrieving the table is not dynamically growing. Only one record is being fetched. Even if a new record is added with a button the data is duplicated. New data is not added. Can you help me with this?Thank you,Y.Gautham.

  15. Y. Gautham,It sounds like you might not have placed the bound fields in a repeatable container (subform).Typically, you group your fields (bound to data nodes in a data connection) into a subform (let’s call it “DataSF”), bind the DataSF subform to the data connection itself (or a repeating section within the data), place the DataSF subform inside a flowed subform and then specify, using the Object palette’s Binding tab, that the DataSF subform should repeat for each data item.This would produce a form that would output all records from the database table to which your data connection is referring.

  16. Y. Gautham says:

    Hi Stephen,Thanks for your reply.But unfortunately I am unscuccessful even after following your instructions.I have created a Data Connection to an Access Database. I placed 4 fields of it bound to the data connection in a subform. I placed the subform in a main subform with subform content property “flowed”.But when I go for PDF preview I could only see the first record from the table.A typical issue what I observed is when I am trying to bind the Data Connection to Subform I am not able to select DataConnection from the menu (shown when we click at the triangle beside Default Binding field in the Binding Property of the subform). I have entered “$record.DataConnection” manually in the field.Thanks for reading this patiently. Your response is heartfully appreciated.

  17. Y. Gautham,I hope you’ll accept my appologies for not providing the “full answer” to your question in my first reply. I was under the impression that it was possible to load all records from an ODBC data connection much in the same way as one can for XML Schema (XML Data file) data connections. It seems I was mistaken, however, because the nature of ODBC data connections is to load a single record (single table row) at a time. You are therefore required (at this time) to write a script which iterates through the records using the first() and next() functions on the Data Connection object and for each record, use the DataSF’s Instance Manager (“_DataSF”) to insert instances populated with data from each record.Fortunately, most of the work is already done for you if you use the Initialize script from the Data List Box object found in the Library palette’s Custom tab. All you need to do is modify it a little in order to create instances of the DataSF subform.Since I figure the “full answer” was better explained in a blog post that everyone would notice, I wrote a little sample which details the steps to follow: “Displaying All Records from an ODBC Data Connection”:http://blogs.adobe.com/formbuilder/2006/10/displaying_all_records_odbc_dataconn.html

  18. Nathan says:

    I hope that someone is able to help me. I have posted the same question on the forums at Adobe, so I will hopefully come up with an answer.I work for a registered charity in Manchester, at which we have recently redesigned our website. In order to generate more interest in job applications which we advertise, we have included online application forms. The XML data submitted is ok for me to read and understand, but I would like to know if there is a free, or very cheap way of importing the information the original PDF form without buying the full license for new Acrobat software, in turn making it easier for my colleagues to understand. We don’t mind using 3rd party plugins, or separate software, as long as they are free, or cheap.Many thanks

  19. Nathan,In terms of Adobe solutions, the cheapest way to get you there would be to purchase one copy of Acrobat Standard. This would let you import the data you receive into the form and save it as one combined unit. The form and data could then be passed-around to those that need to process it.Otherwise, I would suggest writing a little JScript that uses the Microsoft XML Parser to parse the XML data and display it in legible form in a message box. Or you could write an XSL translation that formats the XML data into legible form and again use a little JScript to apply the XSLT to the XML and output a text file, for example. These solutions are free of cost and relatively simple to do if you’re knowledgeable in writing JScripts.I can provide pointers on my JScript suggestion if you’re interested. If you used the XSLT solution, you could process it on your system when you receive the data and only distribute the legible version of it.

  20. Atiq says:

    Hi,I am working with insertInstance Object. But problem is my Designer 7.1 says its not a function. Can anyone help me out regarding this.

  21. Marleen says:

    Can we populate one form with data from another form. I have one form that will take some user info and depending on user choice open up another form pre-filled with user info entered.We will be using Acrobat Pro.Thanks in advance for your help!!

  22. Atiq,Unfortunately, the Instance Manager‘s insertInstance method is only available when running your form in Acrobat 8.0 or later. This means that you can still use Designer 7.1 to design a form that uses the insertInstance method however you’ll need to preview or run the form within Acrobat or Reader 8.0 or later.I appologize for the typo in my post on the Instance Manager a few days ago. I’ve made the correction.If you need to target versions of Acrobat prior to 8.0, I would suggest you use a combination of the addInstance and moveInstance methods instead of insertInstance.

  23. Marleen,Aside from using LiveCycle Workflow (which was designed for this sort of thing), I believe the only way you could achieve this is by connecting the forms to a central data repository (i.e. a database). The first form would set values in the database and cause the second form to be loaded (opened). The second form would then retrieve those saved values from the database and pre-fill the form as needed.

  24. Raul says:

    Can I merge two .xml files into a dynamic pdf form created in Adobe Pro? I need to import from two different .xml files into a form. Any suggestions?

  25. Raul,When you merge XML data into a form, you’re really importing XML data which respects a certain schema. That schema is either implied from the form’s object hierarchy (via containers and the fields they contain) or it’s done according to a data connection to a schema. The latter lets you use explicit bindings such that you can map specific data nodes to specific fields regardless of hierarchy.While XFA supports multiple data connections in a form, only one can be to a schema.So where does that leave you with importing two XML files? Fortunately, schemas can be combined — that is, you can have one schema import another schema and then create a data connection to the (combined) resulting schema. This way, you can import the entire set of data (both XML data files) as one data file.If you’re not using schemas, then you might also be able to simply combine the two XML data files into one.

  26. Aaron says:

    Folks I would like some simple instructions on creating a wsdl web service and binding form fields to it so that the fields are populated at runtime..In the end I would like to be able to create have a webservice that a user can go to then select an identifier (name etc..) and get a read-only form with their data in it..this saves us from havign to manually create the pdf etc..thanks in advance !!

  27. Aaron,Designer provides a way to create a data connection to a web service (WSDL). Such connections can execute request and response methods on web services. Once you define the data connection using the Data View palette, you’ll be presented with a data node tree. You can then drag these nodes onto a form to create fields that are bound either to the request or response method.You could therefore hide all the request fields and populate them automatically with the identifier that the user selected and execute the data connection in the form’s Initialize event to get the response fields populated with data when the form is opened.To execute the data connection when the form is loaded, you could simply insert a button on a form, specify it to be an Execute button and set it to execute the data connection to the WSDL (using the Execute tab in the Object palette) and then specify

    this.execEvent(“click”);

    as its Initialize event script. This would have the effect of executing the data connection, submitting the pre-populated data, receiving the response and populating the response fields with the response data.

  28. mj says:

    In LiveCycle Designer, how do you set up a field in a form that performs the following: When you chose an item from a dropdown list you created it prefills another field with different information. For exemple you chose a city in one dropdown field and the corrosponding state prefills automatically in another field.

  29. mj,This is typically done by scripting the Change event of the drop down list or list box object.In the Change event, which is fired every time the selection is about to change, you can then use the xfa.event.newText object to determine the text property of the item that the user has selected. Using the text, you can then determine the item’s value, if need be, by using the boundItem method of the object (“this” in JavaScript or “$” in FormCalc).For example, if the drop down list contained items with their text set to the city name and their value set to an ID of some sort that would then use to determine the associated state, you would do something like this in its Change event (in JavaScript here but FormCalc is fine as well):

    var sNewText = xfa.event.newText;var sNewValue = this.boundItem(sNewText);if (sNewValue == “CA”)    StateField.rawValue = “California”;

  30. Bonni W. says:

    Please do me a huge favor and check out the form I created at http://www.onemain.com/~bonster/february.pdf (it’s not spam, I swear, I just need help). I just got Adobe 7.0 Pro and am learning as I go.I have had two drivers send in their forms via email with an attachment in .xml format. However, when I go to “save target as” it saves it as .html instead. So when I try to import the file to a blank form, it won’t accept it.I have to retrieve this kind of stuff via my laptop, as the big computer is not as advanced. Therefore, I go wireless and connect to earthlink.net to retrieve my email through the browser.What am I missing here? Sorry, I’m a total novice when it comes to using Adobe Pro. Thanks in advance,BW

  31. Bonni W.,It sounds to me like the problem lies with the way you retrieve the form’s XML data that was submitted via email, not with Acrobat.You might be able to fix this either by forcing the extension to be “XML” in the “Save Target As” dialog or by manually changing the extension on the file once you’ve saved it.If Earthlink.net is somehow wrapping the XML file attachment in an HTML file (or, even worse, encoding the XML data for display as HTML), you’ll need to contact them in order to figure-out how to properly retrieve the XML data file that’s attached to an email.

  32. Alex says:

    HelloHave a project coming up next week.Engineers scan their drawings into PDF. They use it as template for different jobs. On these PDF forms instead of actual dimensions eng. use variables. For each job then they would have Excel file with all dimensions for corresponding var.The question is how to automate this process, so the application will take PDF, excel sheet and substitute variables on the PDF with actual values from excel.Any suggestions would be greatly appreciated!Thank you

  33. Harrison says:

    Hello. I’m trying to create a price list that is linked to an Excel sheet of part numbers, descriptions, and prices.I’d like the fields in my PDF for these to be linked directly to a cell (which is a calculation) so that when the database changes, so will the PDF.I can’t seem to find a way to associate the PDF fields with the Excel fields.Any help would be appreciated. Thanks!

  34. Alex,I would suggest you use the Microsoft Excel Driver for ODBC connections to define a DSN to the Excel spreadsheet. Then, in Designer, create a new ODBC data connection (using the Data View palette) to this DSN. Note that you’ll need to specify an SQL statement for the connection: I found a tutorial on creating ODBC connections to Excel spreadsheets which gives a sample SQL statement that you can use (see step #3).This will get data from the Excel spreadsheet into your form.A word of caution: Unless you know how to properly reference a column with spaces in its heading name (in row #1), make sure that none of your column header labels/names have spaces in them or you’ll have a lot of grief trying to get this to work.Please let me know how it works-out!

  35. Alex says:

    Hi StefanThanks a lot for the response. I got an idea where to start.Still a little confuse though. Creating DSN to the Excel shouldn’t be a problem. But everything regarding Adobe is new for me. Not sure how do I take a scanned PDF document (drawing) and extract variables from there for substitution? I’m working with Adobe Professional 6.0.Anyway, thanks again, I’ll definitely let you know how it goes. I would have to start working on it within day or two.Alex

  36. Harrison,I think you also need to use the Microsoft Excel Driver for ODBC connections in order to get live data from an Excel spreadsheet.Please see the comment I just posted here to Alex on Feb 12, 2007, 02:18 PM: It has a link and some tips about Excel ODBC connections.

  37. Alex,If you’re using Acrobat Pro 6.0, then I presume you’re using Designer 6.0 as well?You might be able to use an image object (found in the Library palette’s Standard tab) to include your drawing as a background to the form. (Note that I’m not talking about an image field in this case since it’ll have undesired side-effects when used as the background for a form.)Once you have that done, you should be able to position text or numeric fields above the image (if they disappear behind it, just use the “Bring to Front” command in the Layout menu) and bind those fields to data nodes in your Excel ODBC data connection.

  38. Chris Q says:

    End users are completing an online form that generates an excel spreadsheet. We are trying to take that data from the excel spreadsheet and map the data to an existing Adobe PDF form, automatically updating the PDF form so end users can save / print the form. Can this be done? What additional tools are needed? Thanks.

  39. Chris Q,You should be able to import data from an Excel spreadsheet by using Microsoft’s Excel ODBC driver.See my response to another comment on this article which provides a little more information on how to do this, along with some links.

  40. chris says:

    Hi. I am having some difficulty working out a solution to a work flow.I have a form that is filled out that will insert a db record or change a db record. The workflow is as such:1. Author fills in form and locks the form data and sends to manager for approval.2. Manager reviews form data. Accepts – db is updated with form data. Rejects the form goes back to the author to amend.Here is the issue. How can I get the author to unlock the form to amend the data – how does the form know it’s the author.I thought may I could use a digital signature.Is there anyway someone that has signed a document can “unsign it” thereby removing the field locks. I may also run into trouble updating the db via script once the form has been digitally signed.If you have any other approaches I sure would like to hear about them.The data signature seems interesting, but I don’t actually want to submit the data anyway – just have the user say the information is correct.This blog has been a life saver to me so thanks for all your time and effort.Chris

  41. Chris,I’m delighted to hear that you find my blog useful!I don’t believe Digital Signatures will help you in this case. One of the principals behind Digital Signatures is that they must ensure “non-repudiation”, which means that an individual cannot deny a signature is theirs. If one could, it would essentially be the same as being able to remove one’s Digital Signature from a signed document (or signed data).In all honesty, what you’re wanting to achieve is really what the combination of Adobe’s LiveCycle Forms, Form Manager and Workflow was designed to do (and much more).Short of purchasing those products, there isn’t really anything that can do “proper” authentication the way you’re wanting to. There are certainly ways to build a basic form of authentication right into the form but it would only serve as a deterrent at best.For example, XFA supports password fields that mask their value. You could include two password fields on the form: The first one would be used by the author to set the password for that form and “lock” the fields while the second would be used to verify the password and “unlock” the fields.If there’s no value in the “initial” password field, then all fields are “unlocked” (i.e. writable) when the form is opened so that the author may enter values into the fields. Once the author is ready to submit the form to their manager, they enter a password and submit the form. (Note that the password is submitted in clear text.)When the manager opens the form, all fields become “locked” (that is, read-only) because there’s an initial password specified. If they disapprove of the form and send it back to the author, the author opens the form (which now has its fields locked, or set as read-only) and verifies the password in the second password field, which then unlocks the fields. (Note the second password field would be un-bound such that its value would not be transmitted with the data since it’s not necessary and you don’t get into a situation where the form is opened and the password is already confirmed…).When the manager finally approves the form, all the data — except for the initial password — gets submitted to the database.Makes sense? It’s a little difficult to explain in words — hopefully you understand what I’m trying to say.

  42. Dex says:

    I am a form virgin creating a form in Adobe Designer. I have used HTML in the past but never Adobe so I thought I would give it a shot. I am the only technologically inclined person in my office and am wondering the best way to go about importing the data for viewing. If it was just me in the process I would just import it. Originally it will arrive by email into one box and be forwarded to someone else. Is there an easier way to do this without having to import to the original form to view the data? Can this be done server side and THEN emailed in the form? Perhaps a stupid question, but its the only way I know to explain it. Thanks!

  43. Jim says:

    Hi Stefan,Do you know where I can find a sample PDF and sample web service to do import data from a web service? I failed to figure out how to make it work.Thanks

  44. Dex,I’m glad to hear that you’re giving LiveCycle Designer a try!I think what you’re asking for is an alternative to form data being submitted/received as an XML Data File attached to an email. This is cumbersome because the recipient of the forwarded email must then know enough about Acrobat in order to import the XML Data into a blank copy of the form.The only way to get the data without having to import it into the form is to submit the form itself along with the data filled-in.You can do this in Designer 8.0 by using a regular submit button (use a button object from the Library palette and select “Submit” from the “Control Type” property on the Object palette’s Field tab) and specifying “PDF” in the “Submit As” property on the Object palette’s Submit tab.To submit the PDF to an email address, simply enter the following Submit URL:

    mailto:email@address.com

    where “email@address.com” is the email address to which the PDF should be submitted.There’s one catch with this solution, unfortunately, and that’s the fact that by default, people using the Adobe Reader will still not be able to submit the PDF after filling the form (because this would technically be a way of saving the PDF which isn’t allowed in Reader). In order to get your submit button to work properly in Reader, you’ll have to extend your PDF form to enable usage rights in Adobe Reader. This will enable Reader to save data (and therefore submit the entire PDF) when your form is filled. You can extend your PDF form by using the “Enable Usage Rights in Adobe Reader” command under the Advanced menu in Acrobat Pro 8.0.The end-result will be that the complete PDF, including filled data, is submitted to the email address of your choice. This way, form data doesn’t have to be imported into a blank form, upon receipt, in order to be processed.

  45. Jim,I was able to find a sample web service you can test with.It’s nothing complex: It provides a pair Request and Response methods which take information about an employee and return the same information back, respectively.First, create a new data connection to the web service and select the (one and only) “echoEmployee” Operation. That will produce a data connection with 3 items: “echoEmployee Request”, “echoEmployee Response” and “echoEmployeeBtn” in the Data View palette.To try this out quickly, simply drag the entire data connection item onto your form. This will automatically create the appropriate hierarchy of subforms and fields with the proper Import/Export Bindings (you can check them out on the Binding tab in the Object palette) along with a submit button which will execute the operation represented by the data connection.If you run the form in Acrobat, fill-in the top fields and click on the button, the information you filled-in will be submitted as a request to the web service’s “echoEmployee” operation and the response will automatically be displayed in the bottom fields.