Populating a PDF File from ColdFusion
by Ron Kurtus (revised 5 January 2003)
It may be desirable to populate an Adobe Acrobat PDF file with information submitted from a Macromedia ColdFusion form. This is useful for organizations that want enter custom information in an "official" document that can be sent to the user without concern that it could be easily altered. There are some basic steps to follow and several ways to perform this task, from simple coding to using expensive products.
Questions you may have include:
- What is a typical application?
- What are the steps involved?
- What are the coding options?
This lesson will answer those questions.
Being able to dymanically populate a PDF document with custom information has many applications. The Adobe PDF format is the standard for electronic documents that look just like the hardcopy version.
Let's say that your company allowed people to submit online employment applications. Although the records are kept in a database, they also want an official company application form to go in the Human Resources files, along with the hand-written applications.
As a courtesy and to avoid misunderstandings, the company wants to provide the applicant a copy of the official application. A PDF file can be emailed to the applicant and be printed out to look like a copy of the official application form.
An actual applicaiton is where students can apply for admission online to Cardinal Stritch University. Upon completion of the online application, a PDF copy of the school's official admission form is populated with the inforamtion and sent to the studnet and to the school registrar via email.
Graduates of an online course can be sent a diploma with pertinent information taken from the database. They could then print out their "official" diploma.
The steps involved in this process are:
- Create PDF document to populate
- Enter fields with Acrobat
- Create a ColdFusion page to populate the PDF
1. Create PDF document to populate
Create the document you want to populate. This document could be done in Microsoft Word, as an HTML page or using some drawing application. Then create a PDF file of that document.
You must have Adobe Acrobat or the equivalent to create a PDF file. Typically, the easiest way to create a PDF is to click File > Print and select Acrobat Distiller as your printer.
2. Enter fields with Acrobat
Once the document is in the PDF format, open it in Acrobat. Use the menu bar tools to define your fields.
- Use the Form Tool to define the various text fields, give each a name, and designate the font type and size. The field name should correspond to the name of the data you will input.
- Use the Text Tool to modify areas of text. You may have to change the font or font size. It is not the easiest tool to use.
This will be your PDF template.
3. Create a ColdFusion page to populate the PDF
Create a ColdFusion form to gather data from input over the Internet or from a database query. This page or an action page will provide the means to populate the PDF file.
The code you use will depend on the method or software you decide to use. Options will be explained in the next section.
There are several options for providing the ColdFusion code to populate the PDF.
There are simple lines of CFML code that can do a very basic job in populating a PDF file. There are limitations, but it seems to do the trick for many basic applicaitons. See Simple Method to Populate a PDF File with ColdFusion for more about this method.
Someone has written a ColdFusion extension that can be used to create PDF files.
A sophisticated method to populate PDF files is to use activePDF Toolkit, a software application that costs around $500. This tool requires a plugin to the server and relatively complex code. It seems to work well, although the documentation on its advatnages is sparse.
You can convert and send a ColdFusion form as a PDF file using activePDF Toolkit. You simply make a PDF form, create the ColdFusion form, install the activePDF server, and create a ColdFusion page to populate the PDF.
Spread your knowledge
Resources and references
Adobe Acrobat - Area in Adobe site, explaining their Acrobat product
activePDF - Company that sells the activePDF Toolkit needed to convert CF to PDF format
Questions and comments
Do you have any questions, comments, or opinions on this subject? If so, send an email with your feedback. I will try to get back to you as soon as possible.
Share this page
Click on a button to bookmark or share this page through Twitter, Facebook, email, or other services:
Students and researchers
The Web address of this page is:
Please include it as a link on your website or as a reference in your report, document, or thesis.
Where are you now?
Converting a ColdFusion Form to a PDF File