Difference between revisions of "How to create an e-Mail PDF Survey Form"

From Scribus Wiki
Jump to: navigation, search
Line 68: Line 68:
 
'''An example of a script to process FDF files into MS Excel'''
 
'''An example of a script to process FDF files into MS Excel'''
  
Here is a link to an MS Excel spreadsheet with a macro that allows you to extract data from FDF files. The macro is heavily commented to show what each line of code does.[http://www.box.net/shared/e5hdj945gu openfdf.zip]
+
[http://www.box.net/shared/e5hdj945gu openfdf.zip] contains a MS Excel spreadsheet with a macro that allows you to extract data from FDF files. The macro is heavily commented to show what each line of code does.
  
For those without Excel who would like to have the script, here is the macro text. [http://www.box.net/shared/ucureoydhn openfdf.txt]
+
For those without Excel who would like to have the script, http://www.box.net/shared/ucureoydhn openfdf.txt] is the macro script in a text file.  The macro code should be easily converted for use in other applications.
 
 
The macro code should be able to be easily converted to other applications.
 
  
 
'''Possible Uses for this System'''
 
'''Possible Uses for this System'''

Revision as of 03:38, 31 May 2007

Introduction

How often have you ever been emailed a PDF form that you have been told to print it, fill it in with a pen and then fax or post it back to the sender?

….and you thought to yourself, “Why don’t they just send me a PDF form that I can quickly type in the information and email it back.”

With Scribus you can create electronic PDF forms that can do exactly this. In the Scribus Wiki article “Your first PDF form with Scribus” you are shown how to create a sample PDF form and if you tried it, you will have an idea of what is involved.

The demonstration form however uses an online server which is complicated and expensive to setup.

A far simpler way is to use e-mails to exchange the data and the form can be easily modified to change the way the data is transferred. The setup of the Submit Button is all that needs to be changed. Instead of the data being sent as HTML to a web address, the mailto:” command is used. By using the mailto:” command, Adobe Acrobat Reader automatically attaches data in a FDF file to an email. This command works with most mail clients used in Windows and Linux.

FDF is short for Forms Data Format and they are basically text files that contain data from the PDF form. Not quite HTML, but a similar cousin. The form's field names and data are stored within a tag set. Characters between tags are irrelevant and don't appear anywhere within the displayed PDF file.

Adobe Acrobat Reader can open a FDF file but requires the original PDF form to do so. If you double click on a FDF file, Reader requests the location of the PDF form. Once linked up with the PDF form location, the PDF form opens with the FDF data in the fields. FDF files are a fraction of the size of the complete PDF form.


Creating a e-Mail PDF form

Scribussurvey.JPG


In the document “Your first PDF form with Scribus” you are shown how to create a PDF form to submit data to a server. A copy of the example file can be downloaded from a link on that page.

You can easily modify the example form to e-mail the data. Open the Scribus version of the document with Scribus. Right click your mouse on the “Submit” Button (Blue Rectangle). A menu pops up and select PDF Options –> Field Properties

Next select the Action Tab –> choose Submit Form and enter “mailto:” with your email address. Do not tick the Submit data as HTML.


Submit.JPG

Click OK. Now save your document as a PDF and view it with Adobe Acrobat Reader.

Testing your PDF form

Enter some data on the form and click the SUBMIT Button. By answering the prompts and security questions correctly, your email client should create an email with a FDF attachment to the address you specified. Something like the image below.

Email.JPG


Notice the difference in the file size between the FDF and PDF.


How to use FDF files

There are two options that I can think of -

1. Dump the data back into the form and print it, or

2. Extract the data into a spreadsheet or database


While Adobe would prefer you to purchase the full version of Acrobat, you can still do a lot with the free Scribus and Acrobat Reader software.

As the data in the FDF file is text, it is easily accessible by using a script or macro to extract the data contained in it. If you Save a FDF file from a e-mail (this is the only way to get one out of Reader) and open it in a text editor, you will the field names and your data with a whole lot of other characters.

If you use the example, you will see amongst other words and characters, the following words

Country Komentarz Miasto Name No Street Submit Telefon Zip

You will notice that this order is different to the PDF form. The fields are in alphabetical order. If you want your fields in the same order as on the PDF form, then you will need to name the fields in alphabetical order.

For example-

AName BStreet CNo DZip EMiasto FCountry GTelefon HKomentarz Submit


An example of a script to process FDF files into MS Excel

openfdf.zip contains a MS Excel spreadsheet with a macro that allows you to extract data from FDF files. The macro is heavily commented to show what each line of code does.

For those without Excel who would like to have the script, http://www.box.net/shared/ucureoydhn openfdf.txt] is the macro script in a text file. The macro code should be easily converted for use in other applications.

Possible Uses for this System

Club membership applications / database

Client information database

Electronic Survey forms

Electronic examinations