2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2002-08-09 10:26:12 +00:00
|
|
|
<!-- $Revision: 1.4 $ -->
|
2002-04-15 00:12:54 +00:00
|
|
|
<reference id="ref.fdf">
|
|
|
|
<title>Forms Data Format functions</title>
|
|
|
|
<titleabbrev>FDF</titleabbrev>
|
|
|
|
|
|
|
|
<partintro>
|
|
|
|
|
2002-05-06 07:19:01 +00:00
|
|
|
<section id="fdf.intro">
|
|
|
|
&reftitle.intro;
|
2002-04-15 00:12:54 +00:00
|
|
|
<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>
|
2002-05-06 07:19:01 +00:00
|
|
|
</section>
|
|
|
|
|
2002-08-09 10:26:12 +00:00
|
|
|
<section id="fdf.requirements">
|
2002-05-06 07:19:01 +00:00
|
|
|
&reftitle.required;
|
|
|
|
<para>
|
|
|
|
You must download the FDF toolkit from
|
|
|
|
<ulink url="&spec.pdf.fdf;">&spec.pdf.fdf;</ulink>.
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section id="fdf.installation">
|
|
|
|
&reftitle.install;
|
|
|
|
<simpara>
|
|
|
|
You must compile PHP with
|
|
|
|
<option role="configure">--with-fdftk[=DIR]</option>.
|
|
|
|
</simpara>
|
|
|
|
<note>
|
|
|
|
<simpara>
|
|
|
|
If you run into problems configuring PHP with fdftk support, check
|
|
|
|
whether the header file FdfTk.h and the library libFdfTk.so are at
|
|
|
|
the right place. They should be in fdftk-dir/include and
|
|
|
|
fdftk-dir/lib. This will not be the case if you just unpack
|
|
|
|
the FdfTk distribution.
|
|
|
|
</simpara>
|
|
|
|
</note>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section id="fdf.configuration">
|
|
|
|
&reftitle.runtime;
|
|
|
|
&no.config;
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section id="fdf.resources">
|
|
|
|
&reftitle.resources;
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
</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">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
// Save the FDF data into a temp file
|
|
|
|
$fdffp = fopen("test.fdf", "w");
|
|
|
|
fwrite($fdffp, $HTTP_FDF_DATA, strlen($HTTP_FDF_DATA));
|
|
|
|
fclose($fdffp);
|
|
|
|
|
|
|
|
// Open temp file and evaluate data
|
|
|
|
// 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("test.fdf");
|
|
|
|
$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);
|
|
|
|
?>
|
|
|
|
]]>
|
2002-05-06 07:19:01 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
2002-04-15 00:12:54 +00:00
|
|
|
</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
|
|
|
|
-->
|
|
|
|
|