<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.9 $ -->
 <reference id="ref.fdf">
  <title>Forms Data Format Functions</title>
  <titleabbrev>FDF</titleabbrev>

  <partintro>

   <section id="fdf.intro">
   &reftitle.intro;
   <simpara>
    Forms Data Format (FDF) is a format for handling
    forms within PDF documents. You should read the documentation at 
    <ulink url="&spec.pdf.fdf;">&spec.pdf.fdf;</ulink>
    for more information on what FDF is and how it is used in general.
   </simpara>
   <simpara>
    The general idea of FDF is similar to HTML forms. The difference is
    basically the format how data is transmitted to the server when the submit
    button is pressed (this is actually the Form Data Format) and the format
    of the form itself (which is the Portable Document Format, PDF).
    Processing the FDF data is one of the features provided by the fdf
    functions. But there is more.  One may as well take an existing PDF form
    and populated the input fields with data without modifying the form
    itself. In such a case one would create a FDF document
    (<function>fdf_create</function>) set the values of each input field
    (<function>fdf_set_value</function>) and associate it with a PDF form
    (<function>fdf_set_file</function>). Finally it has to be sent to the
    browser with MimeType <literal>application/vnd.fdf</literal>. The Acrobat
    reader plugin of your browser recognizes the MimeType,  reads the
    associated PDF form and fills in the data from the FDF document.
   </simpara>

   <simpara>
    If you look at an FDF-document with a text editor you will find a
    catalogue object with the name <literal>FDF</literal>. Such an object may
    contain a number of entries like <literal>Fields</literal>,
    <literal>F</literal>, <literal>Status</literal> etc..
    The most commonly used entries are <literal>Fields</literal> which points
    to a list of input fields, and <literal>F</literal> which contains the
    filename of the PDF-document this data belongs to. Those entries are
    referred to in the FDF documentation as /F-Key or /Status-Key.
    Modifying this entries
    is done by functions like <function>fdf_set_file</function> and
    <function>fdf_set_status</function>. Fields are modified with
    <function>fdf_set_value</function>, <function>fdf_set_opt</function> etc..
   </simpara>
   </section>

   <section id="fdf.requirements">
    &reftitle.required;
    <para>
     You need the FDF toolkit SDK available from
     <ulink url="&spec.pdf.fdf;">&spec.pdf.fdf;</ulink>.
     As of PHP 4.3 you need at least SDK version 5.0. 
     The FDF toolkit library is available in binary form only,
     platforms supported by Adobe are Win32, Linux, Solaris and AIX.
    </para>
   </section>

   &reference.fdf.configure;

   <section id="fdf.configuration">
    &reftitle.runtime;
    &no.config;
   </section>

   <section id="fdf.resources">
    &reftitle.resources;
    <section id="fdf.resources.fdf">
     <title>fdf</title>
     <para>
      Most fdf functions require a <parameter>fdf</parameter> resource
      as their first parameter. A <parameter>fdf</parameter> resource
      is a handle to an opened fdf file. <parameter>fdf</parameter>
      resources may be obtained using <function>fdf_create</function>,
      <function>fdf_open</function> and <function>fdf_open_string</function>.
     </para>
    </section>
   </section>

   &reference.fdf.constants;

   <section id="fdf.examples">
   &reftitle.examples;
    <para>
     The following examples shows just the evaluation of form data.
     <example>
      <title>Evaluating a FDF document</title>
       <programlisting role="php">
<![CDATA[
<?php
// Open fdf from input string provided by the extension
// The pdf form contained several input text fields with the names
// volume, date, comment, publisher, preparer, and two checkboxes
// show_publisher and show_preparer.
$fdf = fdf_open_string($HTTP_FDF_DATA);
$volume = fdf_get_value($fdf, "volume");
echo "The volume field has the value '<b>$volume</b>'<br />";

$date = fdf_get_value($fdf, "date");
echo "The date field has the value '<b>$date</b>'<br />";

$comment = fdf_get_value($fdf, "comment");
echo "The comment field has the value '<b>$comment</b>'<br />";

if (fdf_get_value($fdf, "show_publisher") == "On") {
  $publisher = fdf_get_value($fdf, "publisher");
  echo "The publisher field has the value '<b>$publisher</b>'<br />";
} else
  echo "Publisher shall not be shown.<br />";

if (fdf_get_value($fdf, "show_preparer") == "On") {
  $preparer = fdf_get_value($fdf, "preparer");
  echo "The preparer field has the value '<b>$preparer</b>'<br />";
} else
  echo "Preparer shall not be shown.<br />";
fdf_close($fdf);
?>
]]>
       </programlisting>
     </example>
    </para>
   </section>
   
  </partintro>

&reference.fdf.functions;

 </reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->