re. g8z at yahoo dot com 18-Oct-2004 06:46
I think there is a line missing in
foreach ($keys as $key => $value)
{
$key = addcslashes($key, "\n\r\t\\()");
$fdf .= "<< /T ($key) /V /$value >> \n";
}
I have changed it to read
$key = addcslashes($key, "\n\r\t\\()");
$value = addcslashes($value, "\n\r\t\\()");
$fdf .= "<< /T ($key) /V /$value >> \n";
Now all the check boxes and radio buttons are populated, not just the last one in the form as was happening before.
Funciones del Formato de Datos de Formulario
Introducción
El Formato de Datos de Formulario (FDF) es un formato para la gestión de formularios al interior de documentos PDF. Es recomendable que lea la documentación en » http://partners.adobe.com/asn/acrobat/forms.jsp para más información sobre lo que FDF es, y el modo de usarlo en general.
La idea general de FDF es similar a la de los formularios HTML. La diferencia es básicamente el formato en que los datos son transmitidos al servidor cuando el botón de envÃo es pulsado (el cual viene a ser el Formato de Datos de Formulario) y el formato del formulario mismo (el cual es el Formato de Documento Portable, PDF). El procesamiento de los datos FDF es una de las caracterÃsticas ofrecidas por las funciones fdf. Pero hay más. También es posible tomar un formulario PDF existente y poblar los campos de entrada con datos sin modificar el formulario mismo. En tal caso, es posible crear un documento FDF (fdf_create()), definir los valores de cada campo de entrada (fdf_set_value()) y asociarlo con un formulario PDF (fdf_set_file()). Finalmente debe ser enviado al navegador con el tipo Mime application/vnd.fdf. El plugin lector de Acrobat en su navegador reconoce el tipo Mime, lee el formulario PDF asociado y aplica los datos del documento FDF.
Si echa un vistazo a un documento FDF con un editor de texto, encontrará un objeto de catálogo con el nombre FDF. Tal objeto puede contener cierto número de entradas como Fields, F, Status etc.. Las entradas usadas con más frecuencia son Fields, la cual apunta a una lista de campos de entrada, y F que contiene el nombre de archivo del documento PDF al que pertenecen estos datos. Esas entradas son referenciadas en la documentación FDF como /F-Key o /Status-Key. La modificación de estas entradas se realiza por medio de funciones como fdf_set_file() y fdf_set_status(). Los campos son mofidicados con fdf_set_value(), fdf_set_opt() etc..
Requisitos
Es necesario el toolkit SDK para FDF disponible en » http://partners.adobe.com/asn/acrobat/forms.jsp. A partir de PHP 4.3.0 necesita por lo menos la versión 5.0 del SDK. La biblioteca del toolkit FDF se encuentra disponible en forma binaria únicamente, las plataformas soportadas por Adobe son Win32, Linux, Solaris y AIX.
Instalación
You must compile PHP with --with-fdftk[=DIR].
Note: 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. The configure script supports both the directory structure of the FDF SDK distribution and the usual DIR/include / DIR/lib layout, so you can point it either directly to the unpacked distribution directory or put the header file and the appropriate library for your platform into e.g. /usr/local/include and /usr/local/lib and configure with --with-fdftk=/usr/local.
Note: Note to Win32 Users In order for this extension to work, there are DLL files that must be available to the Windows system PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the systems PATH), it is not recommended. This extension requires the following files to be in the PATH: fdftk.dll
Configuración en tiempo de ejecución
Esta extensión no tiene directivas de configuración en php.ini.
Tipos de recursos
fdf
La mayorÃa de funciones fdf requieren un recurso fdf como su primer parámetro. Un recurso fdf es un gestor con un archivo fdf abierto. Los recursos fdf pueden obtenerse usando fdf_create(), fdf_open() y fdf_open_string().
Constantes predefinidas
Estas constantes están definidas por esta extensión y estarán disponibles solamente cuando la extensión ha sido o bien compilada dentro de PHP o grabada dinámicamente en tiempo de ejecución.
- FDFValue (integer)
- FDFStatus (integer)
- FDFFile (integer)
- FDFID (integer)
- FDFFf (integer)
- FDFSetFf (integer)
- FDFClearFf (integer)
- FDFFlags (integer)
- FDFSetF (integer)
- FDFClrF (integer)
- FDFAP (integer)
- FDFAS (integer)
- FDFAction (integer)
- FDFAA (integer)
- FDFAPRef (integer)
- FDFIF (integer)
- FDFEnter (integer)
- FDFExit (integer)
- FDFDown (integer)
- FDFUp (integer)
- FDFFormat (integer)
- FDFValidate (integer)
- FDFKeystroke (integer)
- FDFCalculate (integer)
- FDFNormalAP (integer)
- FDFRolloverAP (integer)
- FDFDownAP (integer)
Ejemplos
Los siguientes ejemplos muestran únicamente la evaluación de datos del formulario.
Example#1 Evaluación de un documento FDF
<?php
// Abrir un fdf desde la cadena de entrada entregada por la extensión
// El formulario pdf contenÃa varios campos de entrada de texto con los
// nombres volumen, fecha, comentario, editorial, editor, y dos
// cuadros de verificación mostrar_editorial y mostrar_editor.
$fdf = fdf_open_string($HTTP_FDF_DATA);
$volumen = fdf_get_value($fdf, "volumen");
echo "El campo volumen tiene el valor '<b>$volumen</b>'<br />";
$fecha = fdf_get_value($fdf, "fecha");
echo "El campo fecha tiene el valor '<b>$fecha</b>'<br />";
$comentario = fdf_get_value($fdf, "comentario");
echo "El campo comentario tiene el valor '<b>$comentario</b>'<br />";
if (fdf_get_value($fdf, "mostrar_editorial") == "On") {
$editorial = fdf_get_value($fdf, "editorial");
echo "El campo editorial tiene el valor '<b>$editorial</b>'<br />";
} else
echo "La editorial no será mostrada.<br />";
if (fdf_get_value($fdf, "mostrar_editor") == "On") {
$editor = fdf_get_value($fdf, "editor");
echo "El campo editor tiene el valor '<b>$editor</b>'<br />";
} else
echo "El editor no será mostrado.<br />";
fdf_close($fdf);
?>
Table of Contents
- fdf_add_doc_javascript — Adds javascript code to the FDF document
- fdf_add_template — Adds a template into the FDF document
- fdf_close — Cierra un documento FDF
- fdf_create — Crear un nuevo documento FDF
- fdf_enum_values — Call a user defined function for each document value
- fdf_errno — Return error code for last fdf operation
- fdf_error — Return error description for FDF error code
- fdf_get_ap — Get the appearance of a field
- fdf_get_attachment — Extracts uploaded file embedded in the FDF
- fdf_get_encoding — Get the value of the /Encoding key
- fdf_get_file — Obtener el valor de la clave /F
- fdf_get_flags — Gets the flags of a field
- fdf_get_opt — Gets a value from the opt array of a field
- fdf_get_status — Obtener el valor de la clave /STATUS
- fdf_get_value — Obtener el valor de un campo
- fdf_get_version — Gets version number for FDF API or file
- fdf_header — Sets FDF-specific output headers
- fdf_next_field_name — Obtener el siguiente nombre de campo
- fdf_open_string — Read a FDF document from a string
- fdf_open — Abrir un documento FDF
- fdf_remove_item — Sets target frame for form
- fdf_save_string — Returns the FDF document as a string
- fdf_save — Guardar un documento FDF
- fdf_set_ap — Establecer la apariencia de un campo
- fdf_set_encoding — Sets FDF character encoding
- fdf_set_file — Establecer el documento PDF en donde desplegar datos FDF
- fdf_set_flags — Sets a flag of a field
- fdf_set_javascript_action — Sets an javascript action of a field
- fdf_set_on_import_javascript — Adds javascript code to be executed when Acrobat opens the FDF
- fdf_set_opt — Sets an option of a field
- fdf_set_status — Establecer el valor de la clave /STATUS
- fdf_set_submit_form_action — Sets a submit form action of a field
- fdf_set_target_frame — Set target frame for form display
- fdf_set_value — Establecer el valor de un campo
- fdf_set_version — Sets version number for a FDF file
FDF
12-Jul-2007 06:49
12-Jan-2006 01:37
Changing the
session.cache_limiter
directive in the php.ini file to 'private'
seems to resolve the issue with sending fdf data and session headers at the same time to Internet Explorer.
19-Oct-2005 05:05
For those of you struggling with FDF in Internet Explorer, here is your solution:
DO NOT INITIALIZE A SESSION ON THE PAGE THAT GENERATES AND OUTPUTS FDF DATA.
This will fix the page not found error.
Use "Yes" instead of "On" to populate checkboxes.
For the example below, I have not b een able to have it populate checkbox fields.
18-Oct-2004 08:46
This is for users who are looking for a way to merge HTML form data with a PDF Form, then output the PDF Form with data populated in it, to a web browser.
This is a pure PHP solution which does NOT require the FDF toolkit. Contributed by www.TUFaT.com
<?php
// the full http path to the PDF form
$form = 'http://my_domain.com/my_pdf_form.pdf';
function create_fdf ($pdffile, $strings, $keys)
{
$fdf = "%FDF-1.2\n%‚„œ”\n";
$fdf .= "1 0 obj \n<< /FDF << /Fields [\n";
foreach ($strings as $key => $value)
{
$key = addcslashes($key, "\n\r\t\\()");
$value = addcslashes($value, "\n\r\t\\()");
$fdf .= "<< /T ($key) /V ($value) >> \n";
}
foreach ($keys as $key => $value)
{
$key = addcslashes($key, "\n\r\t\\()");
$fdf .= "<< /T ($key) /V /$value >> \n";
}
$fdf .= "]\n/F ($pdffile) >>";
$fdf .= ">>\nendobj\ntrailer\n<<\n";
$fdf .= "/Root 1 0 R \n\n>>\n";
$fdf .= "%%EOF";
return $fdf;
}
// Fill in text fields
$strings = array(
'date' => '10/17/2004',
'full_name' => 'Joe Doe',
'phone_num' => '123-4567',
'company' => 'ACME Widgets',
'amount' => 'USD 100.00'
);
// Fill in check boxes/radio buttons
$keys = array('
gender' => 'male',//radio button
'is_adult' => 'Off',//checkbox
'urgent' => 'On'//checkbox
);
// Output the PDF form, with form data filled-in
header('Content-type: application/vnd.fdf');
echo create_fdf($form, $strings, $keys);
?>
07-Oct-2004 08:09
Basic FDF data is easy to create using native PHP; you don't need Adobe's FDF Toolkit. I wrote a function for this purpose called forge_fdf(). You can download it from:
http://www.pdfhacks.com/forge_fdf/
I created it for my book, PDF Hacks. An example of forge_fdf() in action can be viewed online:
http://pdfhacks.com/form_session/form_session-1.1/
Download the full code for this online example from:
http://pdfhacks.com/form_session/
Note how the PDF form data is submitted back to the server via POST rather than FDF. No need to parse FDF.
Cheers-
Sid Steward
03-Oct-2004 06:18
Use these functions instead if you want to create an FDF file without installing the FDF toolkit. You would use it the same way as the fdf_* functions. BTW, I only wrote the basic library functions for creating FDFs.
define('ntk_FDFValue', 0);
define('ntk_FDFStatus', 1);
define('ntk_FDFFile', 2);
define('ntk_FDFID', 3);
define('ntk_FDFFf', 5);
define('ntk_FDFSetFf', 6);
define('ntk_FDFClearFf', 7);
define('ntk_FDFFlags', 8);
define('ntk_FDFSetF', 9);
define('ntk_FDFClrF', 10);
define('ntk_FDFAP', 11);
define('ntk_FDFAS', 12);
define('ntk_FDFAction', 13);
define('ntk_FDFAA', 14);
define('ntk_FDFAPRef', 15);
define('ntk_FDFIF', 16);
define('ntk_FDFEnter', 0);
define('ntk_FDFExit', 1);
define('ntk_FDFDown', 2);
define('ntk_FDFUp', 3);
define('ntk_FDFFormat', 4);
define('ntk_FDFValidate', 5);
define('ntk_FDFKeystroke', 6);
define('ntk_FDFCalculate', 7);
define('ntk_FDFNormalAP', 1);
define('ntk_FDFRolloverAP', 2);
define('ntk_FDFDownAP', 3);
function ntk_fdf_header() {
header('Content-type: application/vnd.fdf');
}
function ntk_fdf_create() {
$fdf['header'] = "%FDF-1.2\n%‚„œ”\n1 0 obj \n<< /FDF ";
$fdf['trailer'] = ">>\nendobj\ntrailer\n<<\n/Root 1 0 R \n\n>>\n%%EOF";
return $fdf;
}
function ntk_fdf_close(&$fdf) {
unset($fdf);
}
function ntk_fdf_set_file(&$fdf, $pdfFile) {
$fdf['file'] = $pdfFile;
}
function ntk_fdf_set_target_frame(&$fdf, $target) {
$fdf['target'] = $target;
}
function ntk_fdf_set_value(&$fdf, $fieldName, $fieldValue) {
$fdf['values'] = array_merge($fdf['values'], array($fieldName => $fieldValue));
}
function ntk_fdf_add_doc_javascript(&$fdf, $scriptName, $script) {
$fdf['docscripts'] = array_merge($fdf['docscripts'], array($scriptName => $script));
}
function ntk_fdf_set_javascript_action(&$fdf, $fieldName, $trigger, $script) {
$fdf['fieldscripts'] = array_merge($fdf['fieldscripts'], array($fieldName => array($script, $trigger)));
}
function ntk_fdf_save(&$fdf, $fdfFile = null) {
$search = array('\\', '(', ')');
$replace = array('\\\\', '\(', '\)');
$fdfStr = $fdf['header'];
$fdfStr.= "<< ";
if(isset($fdf['file'])) {
$fdfStr.= "/F (".$fdf['file'].") ";
}
if(isset($fdf['target'])) {
$fdfStr.= "/Target (".$fdf['target'].") ";
}
if(isset($fdf['docscripts'])) {
$fdfStr.= "/JavaScript << /Doc [\n";
// populate the doc level javascripts
foreach($fdf['docscripts'] as $key => $value) {
$fdfStr.= "(".str_replace($search, $replace, $key).")(".str_replace($search, $replace, $value).")";
}
$fdfStr.= "\n] >>\n";
}
if(isset($fdf['values']) || isset($fdf['fieldscripts'])) {
// field level
$fdfStr.= "/Fields [\n";
if(isset($fdf['fieldscripts'])) {
// populate the field level javascripts
foreach($fdf['fieldscripts'] as $key => $val) {
$fdfStr .= "<< /A << /S /JavaScript /JS (".str_replace($search, $replace, $val[0]).") >> /T (".str_replace($search, $replace, $key).") >>\n";
}
}
if(isset($fdf['values'])) {
// populate the fields
foreach($fdf['values'] as $key => $value) {
$fdfStr .= "<< /V (".str_replace($search, $replace, $value).") /T (".str_replace($search, $replace, $key).") >>\n";
}
}
$fdfStr.= "]\n";
}
$fdfStr.= ">>";
$fdfStr.= $fdf['trailer'];
if($fdfFile) {
$handle = fopen($fdfFile, 'w');
fwrite($handle, $fdfStr);
fclose($handle);
}
else {
echo $fdfStr;
}
}
01-Jul-2004 08:34
If you want to add FDF support without rebuilding your RedHat EL3 / Fedora PHP RPMs, see instructions at http://phprpms.sourceforge.net/fdf
26-Mar-2004 12:16
Do not use version 6 of the fdftk.dll (windows) with PHP4.3.4, use the one that comes with PHP.
If you use the newer DLL fdf_create will not return a valid handle.
18-Dec-2003 05:40
The code suggested by greg@... and adam@... is extremely helpful, but I've found out (the hard way) that unclosed parentheses within strings contained in the input array ($values in greg's code or $pdf_data in adam's) will cause Acrobat to issue an error to the effect that the file is corrupted. In other words, if there are strings such as "a) my first point; b) my second point" in the input array, the resulting PDF/FDF file will be considered corrupted by Acrobat. This apparently happens because all the field names in the structure of an FDF file are enclosed in parentheses.
The solution I've devised is to escape all opening and closing parentheses with a backslash, which in turn means you need to escape all backslashes. The code below does all that.
Erik
---------------
function output_fdf ($pdf_file, $pdf_data)
{
$fdf = "%FDF-1.2\n%‚„œ”\n";
$fdf .= "1 0 obj \n<< /FDF ";
$fdf .= "<< /Fields [\n";
$search = array('\\', '(', ')');
$replace = array('\\\\', '\(', '\)');
foreach ($pdf_data as $key => $val)
{
$clean_key = str_replace($search, $replace, $key);
$clean_val = str_replace($search, $replace, $val);
$fdf .= "<< /V ($clean_val)/T ($clean_key) >> \n";
}
$fdf .= "]\n/F ($pdf_file) >>";
$fdf .= ">>\nendobj\ntrailer\n<<\n";
$fdf .= "/Root 1 0 R \n\n>>\n";
$fdf .= "%%EOF";
return $fdf;
}
08-May-2003 03:33
If you get the new fdftkv5.tar.gz from adobe's site (per the link above), you'll get some totally new spacing and capitalization of files. To make the current 4.3.1 configure, you need to do a few things.
untar fdftkv5.tar.gz into /usr/local
cd /usr/local
#for ease of use
ln -s FDFToolkit\ for\ UNIX fdf
cd fdf
ln -s Headers\ And\ Libraries HeadersAndLibraries
#may need to modify the following for your OS
ln -s LINUX linux
cd linux/C
ln -s LIBFDFTK.SO libfdftk.so
cd ..
cd ..
ln -s Headers headers
cd headers
ln -s FDFTK.H fdftk.h
And that should get you going... and to whoever is maintaining the configure script, please be aware there are changes in the FDF Toolkit.
05-Mar-2003 04:17
Maybe you have to use Header-function that your browser will regonize xfdf-file. Like this:
Header( "Content-type: application/vnd.adobe.xfdf");
20-Jan-2003 06:06
I have tried to use the scripts above by adam and Toppi and I have been unable to get them to work unless I save the generated fdf file and then open it manually in acrobat.
26-Nov-2002 10:18
I tried a lot with FDF -> PDF and merging these documents...
in my opinon xfdf is more handy than fdf... for those who'd like to try: feel free to use this little function to generate an xfdf document from an array.
ToPPi
function array2xfdf($xfdf_data, $pdf_file) {
// Creates an XFDF File from a 2 dimensional
// Array Format: "array ("key1" => "content1", "key2" => "content2");
$xfdf = "<?xml version='1.0' encoding='UTF-8'?>\n";
$xfdf .= "<xfdf xmlns='http://ns.adobe.com/xfdf/' xml:space='preserve'>\n";
$xfdf .= "<fields>\n";
// Loop -> Array to XFDF Data
foreach ($xfdf_data as $key => $val) {
$xfdf .= "<field name='".$key."'>\n";
$xfdf .= "<value>".$val."</value>\n";
$xfdf .= "</field>\n";
};
// XFDF "Footer"
$xfdf .= "</fields>";
$xfdf .= "<f href='".$pdf_file."'/>";
$xfdf .= "</xfdf>";
return $xfdf;
}
22-Oct-2002 01:24
IMPORTANT:
If you handled the FDF POSTs via $HTTP_RAW_POST_DATA as in user contributed scripts above, it's good to know that once you decide to rebuild PHP with FDFToolkit support, $HTTP_RAW_POST_DATA will be undefined.
Good news - $HTTP_FDF_DATA _will_ be defined instead. (Look at the example above).To get the user contributed scripts working in both plain PHP and PHP+FDFToolkit use
$HTTP_RAW_POST_DATA . $HTTP_FDF_DATA
where $HTTP_RAW_POST_DATA mentioned.
Dimitri Tarassenko
02-Aug-2002 09:30
Here is yet another example of generating pre-filled PDFs without using the FDF functions. This function takes two args: a URL to the PDF (like "http://domain.com/path/to/form.pdf" and an array with all the field's values.
/*
WARNING!! THIS FUNCTION SENDS HTTP HEADERS! It MUST be called before
any content is spooled to the browser, or the function will fail!
void output_fdf (string $pdf_file, array $pdf_data)
$pdf_file: a string containing a URL path to a PDF file on the
server. This PDF MUST exist and contain fields with
the names referenced by $pdf_data for this function
to work.
$pdf_data: an array of any fields in $pdf_file that you want to
populate, of the form key=>val; where the field
name is the key, and the field's value is in val.
*/
function output_fdf ($pdf_file, $pdf_data) {
$fdf = "%FDF-1.2\n%‚„œ”\n";
$fdf .= "1 0 obj \n<< /FDF ";
$fdf .= "<< /Fields [\n";
foreach ($pdf_data as $key => $val)
$fdf .= "<< /V ($val)/T ($key) >> \n";
$fdf .= "]\n/F ($pdf_file) >>";
$fdf .= ">>\nendobj\ntrailer\n<<\n";
$fdf .= "/Root 1 0 R \n\n>>\n";
$fdf .= "%%EOF";
/* Now we display the FDF data which causes Acrobat to start */
header ("Content-Type: application/vnd.fdf");
print $fdf;
}
09-Mar-2002 06:26
function parse($file) {
if (!preg_match_all("/<<\s*\/V([^>]*)>>/x",
$file,$out,PREG_SET_ORDER))
return;
for ($i=0;$i<count($out);$i++) {
$pattern = "<<.*/V\s*(.*)\s*/T\s*(.*)\s*>>";
$thing = $out[$i][1];
if (eregi($pattern,$out[$i][0],$regs)) {
$key = $regs[2];
$val = $regs[1];
$key = preg_replace("/^\s*\(/","",$key);
$key = preg_replace("/\)$/","",$key);
$key = preg_replace("/\\\/","",$key);
$val = preg_replace("/^\s*\(/","",$val);
$val = preg_replace("/\)$/","",$val);
$matches[$key] = $val;
}
}
return $matches;
}
22-Dec-2001 01:06
Here is an easy script to output fdf data to the browser without using the fdf toolkit or creating an actual fdf file on the server.
By the way acrobat is very picky about line breaks so you must leave the "\n" in the script. The script reads the variables posted to it from a form use POST and creates a fdf file from them. The field names posted to this script must match the field names in the pdf. Acrobat will ignore any that don't match.
<?php
//path to pdf file
$url="http://www.some_url.com/form.pdf";
$values=$HTTP_POST_VARS;
$fdfdata = "%FDF-1.2\n%‚„œ”\n";
$fdfdata .= "1 0 obj \n<< /FDF ";
$fdfdata .= "<< /Fields [\n";
//loop that adds the field names and values
foreach($values as $key=>$val)
{
$fdfdata.="<< /V ($val)/T ($key) >> ";
}
$fdfdata .= "]\n";
$fdfdata .= "/F ($url) >>";
$fdfdata .= ">>\nendobj\ntrailer\n<<\n/Root 1 0 R\n>>\n";
$fdfdata .= "%%EOF";
/*** Now we display the FDF data which causes Acrobat to start ***/
header ("Content-Type: application/vnd.fdf");
print $fdfdata;
?>
You can use javascript in the pdf to read the values from a GET method posted directly to the pdf. you can see both methods here: http://laundrymat.tv/pdf/
29-Apr-2000 02:42
The simplest thing to do is get the FDF data from $HTTP_RAW_POST_DATA. (unless you have the server library installed none of the fdf data gets parsed!) This is typical of what you get:
%FDF-1.2
1 0 obj
<<
/FDF << /Fields [ << /V (0)/T (amount0)>> << /V (0)/T (amount1)>> << /V (0)/T (amount2)>>
<< /V (0)/T (amount3)>> << /V (0)/T (amount4)>> << /V (0)/T (amount5)>>
<< /V (0)/T (amount6)>> << /V (0)/T (amount7)>> << /V (0)/T (amount8)>>
<< /V (0)/T (amount9)>> << /V /0102 /T (chase_bk)>> << /V (0)/T (count)>>
<< /V (0)/T (invtotal)>> << /V (12/21/2000)/T (sent_ap)>> << /V /Off /T (spec_hand)>>
<< /V (041232)/T (transit_no)>> << /V (THIS FORM IS NOT COMPLETE!!!)/T (X)>>
]
/F (http://x.com/forms/AA00390q.pdf)>>
>>
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF
kill everything before the [ and then parse it down into key value pairs.
I wrote this to create an FDF, make sure you do a
header("Content-type: application/vnd.fdf");
before you echo the returned value to the user.
function FDFput(,$FDFpage)
{
$A = "%FDF-1.2\n1 0 obj\n<< \n/FDF << /Fields [ \n";
$C = " ] \n" ;
if ($FDFpage>"" ) {$C .=" /F ($FDFpage)>>\n";}
$C .= ">>\n>> \nendobj\ntrailer\n\n<</Root 1 0 R>>\n%%EOF\n";
$B = "";
reset($FDFData);
while (list($key, $val) = each($FDFData))
{
if (strlen(trim($val)) > 0 && is_string($key))
{
$B .= "<</T ($key) /V (". $val . ")>>\n";
//echo "<</T ($key) /V (". $val . ")>>\n";
}
}
return $A.$B.$C;
}
It ain't perfect - but it works. (I use HTML for posting to the server, FDF to the browser)
joe
