Create Files on the Fly in ColdFusion
page 2 of 6
by Sarita Mishra
Average Rating: 
Views (Total / Last 10 Days): 34263/ 44

Creating PDF files

To populate a PDF file we need to have some requirements in our system, such as Coldfusion or Adobe Acrobat full version.

These systems requirement some steps to be followed to populate PDF files from ColdFusion.

Create a PDF document to populate

Create a document using either Microsoft Word or html.  Adobe Acrobat must be there to create a PDF for that document.  Save it in WebServer .

Insert required fields using Acrobat

Open the PDF in Acrobat and insert the fields using the menubar Tools, like Form Tool, to create text fields.  Then give a name to each field, a font size and a style.  The name of each field corresponds to the data given as an input. Use the Text Tool to edit the text fields of fonts, size, etc.  Save it and place it in the WebServer.

Create a ColdFusion page to populate PDF

Now open any text editor and create a document; save it as .cfm extension.  Create a coldfusion form to collect data from the fields over internet or using database query.  This page will act as the way to populate the PDF file.

Below we have the code for a FDF file.FDF (Form Data File) which contains all the data to be merged with PDF.

Listing 1     

(The CFM codes for Input)
      <P><B>First Name</B>
      <INPUT TYPE="TEXT" NAME="fname"></P>
      <P><B>Last Name</B>
      <INPUT TYPE="TEXT" NAME="lname"></P>
      <P><INPUT TYPE="SUBMIT" VALUE="Submit"></P>
(The Output Codes)

%FDF-1.2                            --------- Header of FDF 
 1 0 obj <<
 /FDF <<
 /Fields                  -----------FDF body
 /F(      ------- The path of the PDF file
 trailer -------- FDF footer   
 <</Root 1 0 R>>

Run the file and enter the required field to see the PDF file given in /F tag.

View Entire Article

User Comments

Title: great   
Name: Sandy
Date: 2006-11-02 6:33:11 AM
Great job.. keep moving ahead
Title: Kar   
Name: Chandrakanta
Date: 2006-11-01 2:56:09 AM
It is very nice and can also helpful for the new developers. Come across creating different file formats at the time of requirement.
Title: Great Job   
Name: pd
Date: 2006-11-01 2:41:58 AM
Keep it up.
Title: Nice Article   
Name: Tom Anderson
Date: 2006-10-31 1:46:13 AM
Very Nice and informative article for people working on ColdFusion.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2023  |  Page Processed at 2023-12-06 2:55:13 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search