Home > Article > Backend Development > FDF document support for PHP_PHP tutorial
Interaction on the WWW means filling out a form, clicking the submit button, and getting a definite result. Html and HTTP provide a mechanism to easily perform this operation through forms.
PHP uses a very convenient method to support this mechanism. The value of each input field (Annotation: form input box) is stored as a PHP variable with the same name as the input field.
A very similar mechanism has been developed by Adobe, but for PDF documents. They simply call it Acrobat Forms. From a user's perspective, the only difference between Html forms and Acrobat forms is their appearance. The former uses HTML documents, and the latter uses PDF documents to render forms.
To develop a WEB interface, Acrobat forms can also be processed like HTML forms, if the form provides input data like HTML forms. However, Adobe has proposed a new format for form data called FDF (Forms Data Format). PHP already includes support for this format.
The possibility to generate a PDF document from data, such as customizing it, is an additional feature of Acrobat Forms. Using a PDF document as a form and generating a PDF document from data in PHP will be covered in
this article is described in. You will see how easy it is to follow these two examples.
Before you start trying the online examples in this article you will need to install the Acrobat Reader plug-in or use Acrobat 4. If you want to test php scripts on your own web server
you will also need to install PDF Toolkit and enables FDF support in PHP.
Finally, if you develop your own PDF forms you will need Acrobat Exchange 3.x or Acrobat 4.
Over the past few years, Adobe has developed and expanded the Portable Document Format (PDF). One extension is an Acrobat
form that allows users to enter data and send it to the server for processing, just like an HTML form.
Such a PDF document is very similar to a static PDF document, but when you view it with Acrobat reader, you will find editable areas.
Just like in HTML there are many input fields available, such as submit and reset buttons, text input fields, checkboxes, etc..
Creating such a PDF form requires Acrobat Exchange 3.x or the new Acrobat 4 software, unfortunately they only run in Windows and MacOS.
Both provide a way to place different input fields into an existing PDF document.
The submit button passes a URL attribute that is called when it is pressed. This is very much like HTML, but the difference is the format in which the data is sent to the server.
When the Submit button is pressed, data is transferred from the HTML form in a certain format that can be observed in the URL. Acrobat forms support this format, as well as FDF (Form Data Format)
FDP is a new format that requires interpretation by the FDF Toolkit (current version 4.0). If PHP is compiled with FDF support, it can parse FDF data and access any input field by name.
FDF data is generally stored in PHP's HTTP_RAW_POST_DATA variable (just like HTML data is stored in HTTP_POAT_DATA)
The actual assignment of data is done in the PHP script, on the contrary, HTML submission data is done in the PHP engine assigned.
To get what an FDF data looks like, here is an example: (Translation annotation: The original file copied from the Internet is like this, and I can’t see what the garbled characters are, but if it is placed in an English system, it can Check it out)
http://www.bkjia.com/PHPjc/445091.html