// $operation = "list"; //else if ($_REQUEST['pff_op'] == 'env_vars') // $operation = "env_vars"; //else if ($_REQUEST['pff_op'] == 'dump_fields') // $operation = "dump_fields"; //else // $operation = null; //switch ($_REQUEST['file']) { // case 'pdf_file_1': // $fill_func = 'fill_pdf_file_1'; // break; // case 'history_2': // $fill_func = 'fill_pdf_file_2'; // break; //} pdfff_fill_pdffile_and_dump_to_http('test.pdf', 'fill_pdf_file_1', 'fill', true); //error_reporting($error_level); /** * Fills a pdf file <var>$file</var> with the function provided <var>$fill_func</var> and dumps it to http for the browser to download. * * @param string $file pdf filename to fill. * @param string $fill_func - function name of a function that will fills pdf file by writing to a pipe. * @param string $operation 'fill' - DEFAULT. Fill pdf file <var>$file</var> with what is in function <var>$fill_func</var>. <br> * 'list' - List all fields that are available in pdf file $file. <br> * 'env_vars' - List shell enviroment variables. Useful if returned error code is 127 (when paths are wrong).<br> * 'dump_fields' - Dump fields, submitted to be submitted to phpformfiller, to browser. Useful if Unix Shell encoding is wrong.<br> * * @param boolean $flatten - produce "flat" pdf, that is its forms will not be editable any more. */ function pdfff_fill_pdffile_and_dump_to_http($file, $fill_func, $operation = 'fill', $flatten = false) {
if ($_REQUEST['pff_op'] == 'dump_fields') { $operation = "dump_fields"; } else { $operation = null; } } } switch ($_REQUEST['file']) { case 'pdf_file_1': $fill_func = 'fill_pdf_file_1'; break; case 'history_2': $fill_func = 'fill_pdf_file_2'; break; } pdfff_fill_pdffile_and_dump_to_http($file, $fill_func, $operation, $flatten); error_reporting($error_level); /** * Fills a pdf file <var>$file</var> with the function provided <var>$fill_func</var> and dumps it to http for the browser to download. * * @param string $file pdf filename to fill. * @param string $fill_func - function name of a function that will fills pdf file by writing to a pipe. * @param string $operation 'fill' - DEFAULT. Fill pdf file <var>$file</var> with what is in function <var>$fill_func</var>. <br> * 'list' - List all fields that are available in pdf file $file. <br> * 'env_vars' - List shell enviroment variables. Useful if returned error code is 127 (when paths are wrong).<br> * 'dump_fields' - Dump fields, submitted to be submitted to phpformfiller, to browser. Useful if Unix Shell encoding is wrong.<br> * * @param boolean $flatten - produce "flat" pdf, that is its forms will not be editable any more. */ function pdfff_fill_pdffile_and_dump_to_http($file, $fill_func, $operation = 'fill', $flatten = false) {