|
|
|
|
|
|
| |
Use these functions instead if you want to create a 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.
The zip is attached.
-themightyindian
| <?
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;
}
}
?> | | |
|
| fdf_close -- Close an FDF document Categories : PHP, PHP Functions, FDF | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Retrieve text from table and email to your e-
address in pipe delimited format. Categories : PHP, MySQL | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | A PHP function to encrypt and decrypt a number or string or a combination of the two. Categories : PHP, Encryption, Security | | | Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate. Categories : Authentication, PHP | | | file class , uploade file , download file already uploaded on another website Categories : PHP, PHP Classes, Filesystem, Web Services | | | PHP Paypal IPN Integration Class v1.0.0 Categories : PHP, PHP Classes, Payment Gateways | | | Function to remember password Categories : PHP, Authentication, Personalization and Membership | | | Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality. Categories : PHP, GD image library, Graphics | | | readline -- Reads a line Categories : PHP, PHP Functions, Readline | | | a function that builds an HTML select list from any mysql table. Categories : PHP, MySQL, HTML and PHP | | | Math operations on big numbers Categories : PHP, Math. | | | phpAds, a complete banner and ad management system with detailled tracking and stats. Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases | | | Point and Click Interface ala MS Access for creating SQL statements. Categories : MySQL, Complete Programs, General SQL, PHP, Databases | |
|
|
|