function create_xfdf in FillPDF 6
Same name and namespace in other branches
- 8.4 xfdf.inc \create_xfdf()
- 7 xfdf.inc \create_xfdf()
- 5.0.x xfdf.inc \create_xfdf()
create_xfdf
Takes values passed via associative array and generates XFDF file format with that data for the pdf address sullpiled.
Parameters
string $file The pdf file - url or file path accepted:
array $info data to use in key/value pairs no more than 2 dimensions:
string $enc default UTF-8, match server output: default_charset in php.ini:
Return value
string The XFDF data for acrobat reader to use in the pdf form file
1 call to create_xfdf()
- fillpdf_execute_merge in ./
fillpdf.module - Utility function to allow other functions to merge PDFs with the various methods in a consistent way.
File
- ./
xfdf.inc, line 19 - Provides functions for creating XFDF files.
Code
function create_xfdf($file, $info, $enc = 'UTF-8') {
$data = '<?xml version="1.0" encoding="' . $enc . '"?>' . "\n" . '<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">' . "\n" . '<fields>' . "\n";
foreach ($info as $name => $value) {
$data .= '<field name="' . htmlspecialchars($name) . '"><value>' . htmlspecialchars($value) . '</value></field>' . "\n";
}
$data .= '</fields>' . "\n" . '<ids original="' . md5($file) . '" modified="' . REQUEST_TIME . '" />' . "\n" . '<f href="' . $file . '" />' . "\n" . '</xfdf>' . "\n";
return $data;
}