SfC Home > ColdFusion >
Explanation of how to convert a form developed in ColdFusion to an Adobe Acrobat PDF format. Also refer to Macromedia, Allaire, markup language, database, query, SQL, output, code, Ron Kurtus, School for Champions. Copyright © Restrictions
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.
This lesson will cover the
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. There is a mini-quiz near the end of the lesson.
Typical uses
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.
Employment applications
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.
Admission applicaitons
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.
Diplomas
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.
Steps involved
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.
Coding options
There are several options for providing the ColdFusion code to populate the PDF.
Simple code
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.
Medium method
Someone has written a ColdFusion extension that can be used to create PDF files.
Expensive method
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.
Summary
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
The following resources provide information on this subject.
Websites
Adobe Acrobat - Area in Adobe site, explaining their Acrobat product
activePDF - Company that sells the activePDF Toolkit needed to convert CF to PDF format
Books
Mini-quiz to check your understanding
1. What is ColdFusion Studio?
2. What is needed to display ColdFusion pages on the Web?
3. What is a major application of ColdFusion?
If you got all three correct, you are on your way to becoming a Champion in ColdFusion Development. If you had problems, you had better look over the material again.
What do you think?
Do you have any questions, comments, or opinions on this subject? If so, send an email with your feedback. We will try to get back to you as soon as possible.
Share link
Feel free to establish a link from your website to pages in this site.
Or use our form to send this link to yourself or a friend.
Students and researchers
The Web address of this page is
www.school-for-champions.com/coldfusion/cftopdf.htm. Please
include it as a reference in your report, document, or thesis.
Where can you go from here?
Converting a ColdFusion Form to a PDF File
