Ext\Pdf functions - hdijkema/espocrm-hookedformulas GitHub Wiki
Ext\Pdf\Fillin
ATTACHMENT_ID = Ext\Pdf\Fillin(ENTITY_TYPE, ENTITY_ID, DOCUMENT_ID|FILE_ID, FILENAME, [KEY1, VALUE1, ...])
Fetches the document with id DOCUMENT_ID, or, if no document with that id exists, handles it like an uploaded file to EspoCRM with given FILE_ID. This must be a prepared PDF Form with fields that can be filled in with the given KEY/VALUE pairs. A new attachment is created and this attachment is related to ENTITY_TYPE with ENTITY_ID.
The id of the attachment (ATTACHMENT_ID) is returned, or null, if something went wrong.
Note! This function is dependent on PdfTk being installed on your system. See also mikehaertl\pdftk\Pdf.
Example:
// For a given Contact, prepare a Pdf Form...
$store = Entity\Get('accountId');
$case = Entity\Get('relatedCaseId');
$attach_id = ext\pdf\fillin('Contact', $contact_id, $formulier_id, $form_out_name,
'name_contact', name
'name_contact_details', name
'email_contact', email,
'name_store', attr($store, 'name'),
'code_store', attr($store, 'code'),
'case_number', attr($case, 'caseNumber')
);
logAdd(log, 'info', 'attachment id :', $attach_id);
// And then email the prepared form with the given $attach_id to some person...