set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__).'/../../')); // define Font-Path define('SETAPDF_FORMFILLER_FONT_PATH','FormFiller/font/'); // require API require_once('FormFiller/SetaPDF_FormFiller.php'); /** * init a new instance of the FormFiller */ $FormFiller = SetaPDF_FormFiller::factory( "Sunnysunday-Example.pdf" /* Path to original document */, "" /* Owner- or User-Passwort */, "I", /* How to output the document: "F" = to File, "I" = Inline, "D" = Download */ false, // Don't stream false, // render the appearances by the API 'UTF-8' // get field names and values in UTF-8 ); // Check for errors if (SetaPDF::isError($FormFiller)) { echo "<pre>"; print_r($FormFiller); echo "</pre>"; die(); } /** * Use Update or create a whole new document */
<?php /** * set the includepath for SetaPDF APIs * You have to point the the root directory "SetaPDF" */ set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__) . '/../../')); // define Font-Path define('SETAPDF_FORMFILLER_FONT_PATH', 'FormFiller/font/'); // require API 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 */
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'); }