require_once 'FormFiller/SetaPDF_FormFiller.php'; /** * init a new instance of the FormFiller */ $FormFiller =& SetaPDF_FormFiller::factory("Customizer-Example.pdf", "", "I"); // Check for errors if (SetaPDF::isError($FormFiller)) { echo "<pre>"; print_r($FormFiller); echo "</pre>"; die; } // Get all Form Fields $fields =& $FormFiller->getFields(); // Check for errors if (SetaPDF::isError($fields)) { die($fields->message); } /** * to get the fieldnames you can print them with this snipped on your screen */ #echo "<pre>"; #print_r(array_keys($fields)); #echo "</pre>"; #flush(); // Fill in Fields foreach ($fields as $name => $v) { switch (strtolower(get_class($fields[$name]))) { // Textfields case 'setapdf_textfield': $fields[$name]->setValue("SetaPDF");
public function executeEiMulti(sfWebRequest $request) { $client = ClientPeer::retrieveByPk($request->getParameter('id')); $this->forward404Unless($client); set_include_path(sfConfig::get('sf_lib_dir') . '/SetaPDF/'); // define Font-Path define('SETAPDF_FORMFILLER_FONT_PATH', sfConfig::get('sf_lib_dir') . '/SetaPDF/FormFiller/font/'); // require API require_once 'FormFiller/SetaPDF_FormFiller.php'; /** * init a new instance of the FormFiller */ $FormFiller =& SetaPDF_FormFiller::factory(sfConfig::get('sf_app_module_dir') . "/client/templates/multidisciplinary_summary.pdf", "", "I"); $FormFiller->setUseUpdate(false); // Get all Form Fields $fields =& $FormFiller->getFields(); // Check for errors if (SetaPDF::isError($fields)) { die($fields->message); } // Fill in Textfields $fields['child_last']->setValue($client->getLastName()); $fields['child_first']->setValue($client->getFirstName()); $fields['child_middle']->setValue(''); $fields['dob1']->setValue($client->getDob('m')); $fields['dob2']->setValue($client->getDob('d')); $fields['dob3']->setValue($client->getDob('Y')); // Ouput the new PDF return $FormFiller->fillForms('core_summary.pdf'); }