diff --git a/reference/fdf/constants.xml b/reference/fdf/constants.xml index 415f81f4a9..dbde5bd377 100644 --- a/reference/fdf/constants.xml +++ b/reference/fdf/constants.xml @@ -1,5 +1,5 @@ - +
&reftitle.constants; &extension.constants; @@ -265,6 +265,39 @@ + + + + + + FDFNormalAP + (integer) + + + + + + + + + + FDFRolloverAP + (integer) + + + + + + + + + + FDFDownAP + (integer) + + + + diff --git a/reference/fdf/functions/fdf-add-doc-javascript.xml b/reference/fdf/functions/fdf-add-doc-javascript.xml new file mode 100644 index 0000000000..5a23dc3c18 --- /dev/null +++ b/reference/fdf/functions/fdf-add-doc-javascript.xml @@ -0,0 +1,76 @@ + + + + + + fdf_add_doc_javascript + Adds javascript code to the FDF document + + + Description + + boolfdf_add_doc_javascript + resourcefdfdoc + stringscript_name + stringscript_code + + + Adds a script to the FDF, which Acrobat then adds to the doc-level + scripts of a document, once the FDF is imported into it. It is strongly + suggested to use '\r' for linebreaks within script_code. + + + + Adding JavaScript code to a FDF + + +]]> + + will create a FDF like this: + +> >> +>> +endobj +trailer +<< +/Root 1 0 R + +>> +%%EOF +]]> + + + + + + + diff --git a/reference/fdf/functions/fdf-close.xml b/reference/fdf/functions/fdf-close.xml index 58d386678b..dc200ef438 100644 --- a/reference/fdf/functions/fdf-close.xml +++ b/reference/fdf/functions/fdf-close.xml @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ Description boolfdf_close - intfdf_document + resourcefdf_document The fdf_close function closes the FDF document. diff --git a/reference/fdf/functions/fdf-create.xml b/reference/fdf/functions/fdf-create.xml index 94bb8c7140..a35fadba16 100644 --- a/reference/fdf/functions/fdf-create.xml +++ b/reference/fdf/functions/fdf-create.xml @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@ Description - intfdf_create + resourcefdf_create diff --git a/reference/fdf/functions/fdf-errno.xml b/reference/fdf/functions/fdf-errno.xml new file mode 100644 index 0000000000..a04dbffcaa --- /dev/null +++ b/reference/fdf/functions/fdf-errno.xml @@ -0,0 +1,46 @@ + + + + + fdf_errno + Return error code for last fdf operation + + + Description + + intfdf_errno + + + + fdf_errno returns the error code set by + the last fdf_... function call. This is zero + for a successfull operation or a non-zero error code on failure. + A textual description may be obtained using the + fdf_error function. + + + See also fdf_error. + + + + + diff --git a/reference/fdf/functions/fdf-error.xml b/reference/fdf/functions/fdf-error.xml new file mode 100644 index 0000000000..34a4e9ccbb --- /dev/null +++ b/reference/fdf/functions/fdf-error.xml @@ -0,0 +1,47 @@ + + + + + fdf_error + Return error description for fdf error code + + + Description + + stringfdf_error + interror_code + + + fdf_error returns a textual description for + the fdf error code given in error_code. + The function uses the internal error code set by the last operation + if no error_code is given, so + fdf_error() is a convenient shortcut for + fdf_error(fdf_errno()). + + + See also fdf_errno. + + + + + diff --git a/reference/fdf/functions/fdf-get-ap.xml b/reference/fdf/functions/fdf-get-ap.xml new file mode 100644 index 0000000000..211bf6fa86 --- /dev/null +++ b/reference/fdf/functions/fdf-get-ap.xml @@ -0,0 +1,48 @@ + + + + + + fdf_get_ap + Get the appearance of a field + + + Description + + boolfdf_get_ap + resourcefdf_document + stringfield + intface + stringfilename + + + The fdf_get_ap function gets the + appearance of a field (i.e. the value of the /AP key) and + stores it in a file. The possible values of face + are FDFNormalAP, FDFRolloverAP and + FDFDownAP. The appearance is stored in + filename. + + + + + diff --git a/reference/fdf/functions/fdf-get-attachment.xml b/reference/fdf/functions/fdf-get-attachment.xml new file mode 100644 index 0000000000..74f2e179e7 --- /dev/null +++ b/reference/fdf/functions/fdf-get-attachment.xml @@ -0,0 +1,76 @@ + + + + + fdf_get_attachment + Extracts uploaded file embedded in the FDF + + + Description + + arrayfdf_get_attachment + resourcefdf_document + stringfieldname + stringsavepath + + + Extracts a file uploaded by means of the "file selection" field + fieldname and stores it under + savepath. savepath may be + the name of a plain file or an existing directory in which the file is to be created + under its original name. Any existing file under the same name will be overwritten. + + + + There seems to be no other way to find out the original filename but to store + the file using a directory as savepath and check + for the basename it was stored under. + + + + The returned array contains the following fields: + + + path - path were the file got stored + size - size of the stored file in bytes + type - mimetype if given in the FDF + + + + + + Storing an uploaded file + + +]]> + + + + + + + diff --git a/reference/fdf/functions/fdf-get-encoding.xml b/reference/fdf/functions/fdf-get-encoding.xml new file mode 100644 index 0000000000..e489929d4b --- /dev/null +++ b/reference/fdf/functions/fdf-get-encoding.xml @@ -0,0 +1,44 @@ + + + + + fdf_get_encoding + Get the value of the /Encoding key + + + Description + + stringfdf_get_encoding + resourcefdf_document + + + The fdf_get_encoding returns the value + of the /Encoding key. An empty string is returned if the default + PDFDocEncoding/Unicode scheme is used. + + + See also fdf_set_encoding. + + + + + diff --git a/reference/fdf/functions/fdf-get-file.xml b/reference/fdf/functions/fdf-get-file.xml index de3ae82cf5..9904b8df7e 100644 --- a/reference/fdf/functions/fdf-get-file.xml +++ b/reference/fdf/functions/fdf-get-file.xml @@ -1,26 +1,25 @@ - + - - - fdf_get_file - Get the value of the /F key - - - Description - - stringfdf_get_file - intfdf_document - - - The fdf_set_file returns the value - of the /F key. - - - See also fdf_set_file. - - - + + + fdf_get_file + Get the value of the /F key + + + Description + + stringfdf_get_file + resourcefdf_document + + + The fdf_set_file returns the value + of the /F key. + + + See also fdf_set_file. + + + - - - fdf_get_status - Get the value of the /STATUS key - - - Description - - stringfdf_get_status - intfdf_document - - - The fdf_get_status returns the value - of the /STATUS key. - - - See also fdf_set_status. - - - + + + fdf_get_status + Get the value of the /STATUS key + + + Description + + stringfdf_get_status + resourcefdf_document + + + The fdf_get_status returns the value + of the /STATUS key. + + + See also fdf_set_status. + + + + - - - fdf_get_value - Get the value of a field - - - Description - - stringfdf_get_value - intfdf_document - stringfieldname - - - The fdf_get_value function returns the - value of a field. - - - See also fdf_set_value. - - - + + + fdf_get_value + Get the value of a field + + + Description + + stringfdf_get_value + resourcefdf_document + stringfieldname + intwhich + + + The fdf_get_value function returns the + value for the requested fieldname. + + + Elements of an array field can be retrieved by passing the optional + which, starting at zero. For non-array fields + the optional parameter which will be ignored. + + + + Array support and optional which parameter + were added in PHP 4.3. + + + + See also fdf_set_value. + + + + + + fdf_get_version + Gets version number for FDF api or file + + + Description + + stringfdf_get_version + resourcefdf_document + + + This function will return the fdf version for the given + fdf_document, or the toolkit api + version number if no parameter is given. + + + For the current FDF toolkit 5.0 the api version number is '5.0' + and the document version number is either '1.2', '1.3' or '1.4'. + + + See also fdf_set_version. + + + + + diff --git a/reference/fdf/functions/fdf-next-field-name.xml b/reference/fdf/functions/fdf-next-field-name.xml index b97bec1277..e765c9f106 100644 --- a/reference/fdf/functions/fdf-next-field-name.xml +++ b/reference/fdf/functions/fdf-next-field-name.xml @@ -1,30 +1,47 @@ - + - - - fdf_next_field_name - Get the next field name - - - Description - - stringfdf_next_field_name - intfdf_document - stringfieldname - - - The fdf_next_field_name function returns the - name of the field after the field in - fieldname or the field name of the first field - if the second parameter is &null;. - - - See also fdf_set_value, - fdf_get_value. - - - + + + fdf_next_field_name + Get the next field name + + + Description + + stringfdf_next_field_name + resourcefdf_document + stringfieldname + + + The fdf_next_field_name function returns the + name of the field after the field in + fieldname or the field name of the first field + if the second parameter is &null;. + + + + Detecting all fieldnames in a FDF + + +]]> + + + + + See also fdf_enum_fields and + fdf_get_value. + + + + + + fdf_open_string + Read a FDF document from a string + + + Description + + resourcefdf_open + stringfdf_data + + + The fdf_open_string function reads form data + from a string. fdf_data must contain the data + as returned from a PDF form or created using fdf_create + and fdf_save_string. + + + You can fdf_open_string together with + $HTTP_FDF_DATA to process fdf form input + from a remote client. + + + + Accessing the form data + + +]]> + + + + + See also + fdf_open, + fdf_close, + fdf_create and + fdf_save_string. + + + + + diff --git a/reference/fdf/functions/fdf-open.xml b/reference/fdf/functions/fdf-open.xml index 79f1cb066f..e164a18ea8 100644 --- a/reference/fdf/functions/fdf-open.xml +++ b/reference/fdf/functions/fdf-open.xml @@ -1,30 +1,34 @@ - + - - - fdf_open - Open a FDF document - - - Description - - intfdf_open - stringfilename - - - The fdf_open function opens - a file with form data. This file must contain the data as returned - from a PDF form. Currently, the file has to be created 'manually' - by using fopen and writing the content - of HTTP_FDF_DATA with fwrite into it. - A mechanism like for HTML form data where for each input - field a variable is created does not exist. - - - - Accessing the form data - + + + fdf_open + Open a FDF document + + + Description + + resourcefdf_open + stringfilename + + + The fdf_open function opens + a file with form data. This file must contain the data as returned + from a PDF form or created using fdf_create and + fdf_save. + + + You can process the results of a PDF form POST request by writing + the data recieved in $HTTP_FDF_DATA to a file + and open it using fdf_open. Starting with PHP 4.3 + you can also use fdf_open_string which handles temporary + file creation and cleanup for you. + + + + Accessing the form data + ]]> - - - - - See also fdf_close. - - - + + + + + See also + fdf_open_string, + fdf_close, + fdf_create and + fdf_save. + + + + + + fdf_save_string + Returns the FDF document as a string + + + Description + + stringfdf_save_string + resourcefdf_document + + + The fdf_save_string function returns the FDF document as a string. + + + + + Retrieving FDF as a string + + +]]> + + + will output something like + + +> +>> +endobj +2 0 obj +[ +<< /T (foo)/V (bar)>> +] +endobj +trailer +<< +/Root 1 0 R + +>> +%%EOF +]]> + + + + + + + See also fdf_save, + fdf_open_string, + fdf_create and + fdf_close. + + + + + + diff --git a/reference/fdf/functions/fdf-save.xml b/reference/fdf/functions/fdf-save.xml index e3b9d10eb6..70b65330d3 100644 --- a/reference/fdf/functions/fdf-save.xml +++ b/reference/fdf/functions/fdf-save.xml @@ -1,32 +1,33 @@ - + - - - fdf_save - Save a FDF document - - - Description - - intfdf_save - stringfilename - - - The fdf_save function saves - a FDF document. - The FDF Toolkit provides a way to output the document to stdout if - the parameter filename - is '.'. This does not work if PHP is used as an apache module. - In such a case one will have to write to a file and use e.g. - fpassthru to output it. - - - See also fdf_close and example for - fdf_create. - - - + + + fdf_save + Save a FDF document + + + Description + + boolfdf_save + resourcefdf_document + stringfilename + + + The fdf_save function saves a FDF document. + The resulting FDF will be written to filename. + Without a filename fdf_save + will write the FDF to the default PHP output stream. + + + + See also fdf_save_string, + fdf_create and + fdf_close. + + + + + - - - fdf_set_ap - Set the appearance of a field - - - Description - - boolfdf_set_ap - intfdf_document - stringfield_name - intface - stringfilename - intpage_number - - - The fdf_set_ap function sets the - appearance of a field (i.e. the value of the /AP key). - The possible values of face - are 1=FDFNormalAP, 2=FDFRolloverAP, 3=FDFDownAP. - - - + + + fdf_set_ap + Set the appearance of a field + + + Description + + boolfdf_set_ap + resourcefdf_document + stringfield_name + intface + stringfilename + intpage_number + + + The fdf_set_ap function sets the + appearance of a field (i.e. the value of the /AP key). + The possible values of face + are FDFNormalAP, FDFRolloverAP + and FDFDownAP. + + + + - - - fdf_set_encoding - Sets FDF character encoding - - - Description - - boolfdf_set_encoding - intfdf_document + + + fdf_set_encoding + Sets FDF character encoding + + + Description + + boolfdf_set_encoding + resourcefdf_document stringencoding - - - fdf_set_encoding sets the character - encoding in FDF document fdf_document. - encoding should be the valid encoding - name. The valid encoding name in Acrobat 5.0 are - "Shift-JIS", "UHC", - "GBK","BigFive". - - - The fdf_set_encoding is available in - PHP 4.1.0 or later. - - - + + + fdf_set_encoding sets the character + encoding in FDF document fdf_document. + encoding should be the valid encoding + name. Currently the following values are supported: + "Shift-JIS", "UHC", + "GBK","BigFive". + An empty string resets the encoding to the default PDFDocEncoding/Unicode + scheme. + + + + - - - fdf_set_file - Set the value of the /F key + + + fdf_set_file + Set PDF document to display FDF data in - - Description - - boolfdf_set_file - intfdf_document - stringfilename - - - The fdf_set_file sets the value - of the /F key. The /F key is just a reference to a PDF form - which is to be populated with data. - In a web environment it is a URL (e.g. http:/testfdf/resultlabel.pdf). + + Description + + boolfdf_set_file + resourcefdf_document + stringurl + stringtarget_frame + + + The fdf_set_file selects a different PDF + document to display the form results in then the form it originated + from. The url needs to be given as an + absolute URL. + + + The frame to display the document in may be selected using the optional + parameter target_frame or the function + fdf_set_target_frame. + + + Passing FDF data to a second form + + - See also fdf_get_file and example for - fdf_create. + /* start new fdf */ + $fdf = fdf_create(); + + /* set field "foo" to value "bar" */ + $fdf_set_value($fdf, "foo", "bar"); - - + /* tell client to display FDF data using "fdf_form.pdf" */ + fdf_set_file($fdf, "http://www.example.com/fdf_form.pdf"); + + /* output fdf */ + fdf_save(); + + /* clean up */ + fdf_close(); +?> +]]> + + + + See also fdf_get_file and + fdf_set_target_frame. + + + + @@ -10,7 +10,7 @@ Description boolfdf_set_flags - intfdf_document + resourcefdf_document stringfieldname intwhichFlags intnewFlags diff --git a/reference/fdf/functions/fdf-set-javascript-action.xml b/reference/fdf/functions/fdf-set-javascript-action.xml index 6b51df6c09..a2ebc9970c 100644 --- a/reference/fdf/functions/fdf-set-javascript-action.xml +++ b/reference/fdf/functions/fdf-set-javascript-action.xml @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ Description boolfdf_set_javascript_action - intfdf_document + resourcefdf_document stringfieldname inttrigger stringscript diff --git a/reference/fdf/functions/fdf-set-opt.xml b/reference/fdf/functions/fdf-set-opt.xml index d384be0467..11dce77977 100644 --- a/reference/fdf/functions/fdf-set-opt.xml +++ b/reference/fdf/functions/fdf-set-opt.xml @@ -1,5 +1,5 @@ - + @@ -10,7 +10,7 @@ Description boolfdf_set_opt - intfdf_document + resourcefdf_document stringfieldname intelement stringstr1 diff --git a/reference/fdf/functions/fdf-set-status.xml b/reference/fdf/functions/fdf-set-status.xml index 01be8c7c39..aeaeecb046 100644 --- a/reference/fdf/functions/fdf-set-status.xml +++ b/reference/fdf/functions/fdf-set-status.xml @@ -1,27 +1,28 @@ - + - - - fdf_set_status + + + fdf_set_status Set the value of the /STATUS key - + - Description - - boolfdf_set_status - intfdf_document - stringstatus - - - The fdf_set_status sets the value - of the /STATUS key. - - - See also fdf_get_status. - - - + Description + + boolfdf_set_status + resourcefdf_document + stringstatus + + + The fdf_set_status sets the value + of the /STATUS key. When a client recieves a FDF with a status set + it will present the value in an alert box. + + + See also fdf_get_status. + + + + - - - fdf_set_submit_form_action - Sets a submit form action of a field - + + + fdf_set_submit_form_action + Sets a submit form action of a field + - Description - - boolfdf_set_submit_form_action - intfdf_document - stringfieldname - inttrigger - stringscript - intflags - - - The fdf_set_submit_form_action sets a submit form - action for the given field fieldname. - - - See also fdf_set_javascript_action. - - - + Description + + boolfdf_set_submit_form_action + resourcefdf_document + stringfieldname + inttrigger + stringscript + intflags + + + The fdf_set_submit_form_action sets a submit form + action for the given field fieldname. + + + See also fdf_set_javascript_action. + + + + + + fdf_set_target_frame + Set target frame for form display + + + Description + + boolfdf_target_frame + resourcefdf_document + stringframe_name + + + Sets the target frame to display a result PDF defined with fdf_save_file in. + + + See also fdf_save_file. + + + + + diff --git a/reference/fdf/functions/fdf-set-value.xml b/reference/fdf/functions/fdf-set-value.xml index e877428f88..f104a930e0 100644 --- a/reference/fdf/functions/fdf-set-value.xml +++ b/reference/fdf/functions/fdf-set-value.xml @@ -1,31 +1,43 @@ - - - - - fdf_set_value - Set the value of a field - - - Description - - boolfdf_set_value - intfdf_document - stringfieldname - stringvalue - intisName - - - The fdf_set_value function sets the - value of a field. The last parameter determines if the field value - is to be converted to a PDF Name (isName = 1) - or set to a PDF String (isName = 0). - - - See also fdf_get_value. - - - + + + + fdf_set_value + Set the value of a field + + + Description + + boolfdf_set_value + resourcefdf_document + stringfieldname + mixedvalue + intisName + + + The fdf_set_value function sets the + value for a field named fieldname. + The value will be stored as a string unless it is an array. + In this case all array elements will be stored as a value array. + + + + In older versions of the fdf toolkit last parameter determined if the field value + was to be converted to a PDF Name (isName = 1) + or set to a PDF String (isName = 0). The value is no + longer used in the current toolkit version 5.0. For compatibility reasons it is + still supported as an optional parameter beginning with PHP 4.3, but ignored internaly. + + + Support for value arrays was added in PHP 4.3. + + + + See also fdf_get_value and + fdf_remove_item. + + + + + + fdf_set_version + Sets version number for a FDF file + + + Description + + stringfdf_set_version + resourcefdf_document + stringversion + + + This function will set the fdf version + for the given fdf_document. Some features + supported by this extension are only available in newer fdf versions. + For the current FDF toolkit 5.0 version + may be either '1.2', '1.3' or '1.4'. + + + See also fdf_get_version. + + + + + diff --git a/reference/fdf/functions/fdf_header.xml b/reference/fdf/functions/fdf_header.xml new file mode 100644 index 0000000000..7de952b7f6 --- /dev/null +++ b/reference/fdf/functions/fdf_header.xml @@ -0,0 +1,41 @@ + + + + + fdf_header + Sets FDF-specific output headers + + + Description + + boolfdf_header + + + + This is a convenience function to set appropriate HTTP headers + for FDF output. It sets the Content-type: + to application/vnd.fdf. + + + + + diff --git a/reference/fdf/reference.xml b/reference/fdf/reference.xml index 8bef57cd65..ad3ee155de 100644 --- a/reference/fdf/reference.xml +++ b/reference/fdf/reference.xml @@ -1,5 +1,5 @@ - + Forms Data Format functions FDF @@ -50,8 +50,11 @@
&reftitle.required; - You must download the FDF toolkit from + You need the FDF toolkit SDK available from &spec.pdf.fdf;. + 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.
@@ -64,10 +67,16 @@ 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. + 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.
@@ -79,8 +88,16 @@
&reftitle.resources; - - +
+ fdf + + Most fdf functions require a fdf resource + as their first parameter. A fdf resource + is a handle to an opened fdf file. fdf + resources may be obtained using fdf_create, + fdf_open and fdf_open_string. + +
&reference.fdf.constants; @@ -94,16 +111,11 @@ $volume'
";