Presentation is loading. Please wait.

Presentation is loading. Please wait.

Creating a Dynamic Adobe PDF - Using ColdFusion Randy Brown Michigan State Univerisity University Development Randy Brown

Similar presentations


Presentation on theme: "Creating a Dynamic Adobe PDF - Using ColdFusion Randy Brown Michigan State Univerisity University Development Randy Brown"— Presentation transcript:

1 Creating a Dynamic Adobe PDF - Using ColdFusion Randy Brown brownra@msu.edu Michigan State Univerisity University Development Randy Brown brownra@msu.edu Michigan State Univerisity University Development

2 What You Will Need Adobe Acrobat v5.0 (v4.0 or v3.0 will work) Cold Fusion Studio or Text Editor (notepad) Cold Fusion Application Server Adobe Acrobat v5.0 (v4.0 or v3.0 will work) Cold Fusion Studio or Text Editor (notepad) Cold Fusion Application Server

3 What The Client Will Need Acrobat 5.0 Reader (This will work with v3.0 or v4.0) Acrobat Plug-In Compatible Browser (Preferably IE v5.0 or greater) Acrobat 5.0 Reader (This will work with v3.0 or v4.0) Acrobat Plug-In Compatible Browser (Preferably IE v5.0 or greater)

4 FIRST STEP You will need to create a PDF document

5 Create a PDF Document Step 1. Create a PDF Document using Adobe Acrobat from any Windows application by selecting the PDFWriter as your output device Step 2. Print/Save PDF to the Web Server.

6 NEXT STEP You will need to create a PDF form

7 Create a PDF Form Step 1. Use the existing PDF created. Step 2. Insert Form Fields using Adobe Acrobat Step 3. Re-save PDF to Web Server.

8 Things to remember when Creating a PDF Form Always give form fields a name Do not use spaces in name Always set the font and size The border is optional but good to have

9 NEXT STEP Now you have a PDF form, how does it work with a Web Server?

10 What happens when a Client request a PDF? Client Requests PDF Doc Client Receives PDF Doc Server Receives PDF Doc Request Server Sends PDF Doc No magic here, the server handles this request similar to a standard html request.

11 NEXT STEP How do you create the data file (FDF) to populate the PDF fields? A FDF file is a standard DOS/ASCII file This file holds all the data that will be merged with PDF form fields Most importantly it holds the /F switch information

12 Create a FDF File Step 1. Create a FDF file This can be accomplished with CF Studio, a text editor or more advanced with a CFM. Step 2. Save as filename.fdf to the Web Server

13 NEXT STEP We are going to take a closer look at the base components and syntax of a FDF file?

14 Form Data File (FDF) %PDF-1.2 1 0 obj << FDF File Header

15 Form Data File (FDF) %PDF-1.2 1 0 obj << /FDF << /Fields[<</T(Company) /V(Purple Place) >><</T(Address) /V(123 Anywhere) >><</T(CityStateZip) /V(East Lansing, MI 48823) >>] Body (Field Definitions)

16 Form Data File (FDF) %PDF-1.2 1 0 obj << /FDF << /Fields [ << /T(Company) /V(Purple Place) >> << /T(Address) /V(123 Anywhere) >> << /T(CityStateZip) /V(East Lansing, MI 488233) >> ]/F(registration.pdf) PDF Filename

17 Form Data File (FDF) /FDF << /Fields [ << /T(Company) /V(Purple Place) >> << /T(Address) /V(123 Anywhere) >> << /T(CityStateZip) /V(East Lansing, MI 48823) >> ] /F(registration.pdf) >>>>endobjtrailer %EOF FDF File Footer

18 NEXT STEP Now you have a FDF file, how does it works with a PDF and the Web Server?

19 Client Requests FDF Doc Client Receives FDF Doc Server Receives FDF Doc Request Server Sends FDF Doc *Note: FDF file has been created and saved on server already. No magic here, the server handles this request similar to a standard html request. What happens when a Client request a FDF file?

20 Overview of how the FDF file works with a PDF Form Client Requests Specified PDF Doc Client Receives & Merges PDF Doc w/ FDF file Server Receives PDF Doc Request Server Sends PDF Doc After receiving FDF file from Server, the browser (per the Adobe Acrobat Reader) requests the PDF form specified in the /F line Once received, the PDF is merged with the FDF file to create a final document Hint: This is the magic :-).

21 NEXT STEP Now you understand the MAGIC of how the PDF and FDF work together. Lets review how ColdFusion handles a file request and how it fits into this puzzle.

22 Web Server sends CFM file to CFAS for Processing Overview of the ColdFusion file request system Client Requests CFM File Client Receives CFAS HTML Response Server Receives CFM File Request Server Sends CFAS HTML Response CFAS sends back to web server an HTML formatted response Web Server passes CFM page request to CFAS. CFAS processes and returns (typically) HTML response. Web Server passes on what appears to be a file

23 Web Server sends CFM file to CFAS for Processing ColdFusion & FDF Integration Client Requests CFM File Client Receives CFAS FDF Response Server Receives CFM File Request Server Sends CFAS FDF Response CFAS sends back to web server an FDF formatted response Web Server passes on what appears to be an FDF file Web Server passes CFM page request to CFAS. CFAS processes and returns FDF response instead.

24 Overview of how the FDF file works with a PDF Form (again) Client Requests Specified PDF Doc Client Receives & Merges PDF Doc w/ FDF file Server Receives PDF Doc Request Server Sends PDF Doc After receiving FDF file from Server, the browser (per the Adobe Acrobat Reader) requests the PDF form specified in the /F line Once received, the PDF is merged with the FDF file to create a final document

25 LAST STEP How do we automate this process using ColdFusion

26 How to create the code to make a FDF on the fly %FDF-1.2 1 0 obj << /FDF << /Fields [ << /T(Company) /V(Purple Place) >> …other fields ] /F(registration.pdf) >> endobj trailer > %EOF

27 How to add a Query to pull data from a database SELECT * FROM tblPeople WHERE PersonID = ‘kid’ cfsetting enablecfoutputonly="Yes" showdebugoutput="No"> %FDF-1.2 1 0 obj << /FDF << /Fields [ << /T(Company) /V(#myQuery.Company#) >> << /T(Address) /V(#myQuery.Address#) >>

28 Additional Resources www.adobe.com www.planetpdf.com www.peakforms.com www.pdfzone.com www.adobe.com www.planetpdf.com www.peakforms.com www.pdfzone.com


Download ppt "Creating a Dynamic Adobe PDF - Using ColdFusion Randy Brown Michigan State Univerisity University Development Randy Brown"

Similar presentations


Ads by Google