Hi!
I suggest to add one string to extend flexibility of your module:
function _pdf_using_mpdf_generator($html, $filename = NULL) {
...
$mpdf = new mPDF(...)
...
// Ability to alter mPDF settings by other modules.
drupal_alter('mpdf_document', $mpdf);
$mpdf->WriteHTML($html);
...
}
After that we can implement hook_alter in the custom module to change all mPDF setting we want, for example:
function mymodule_mpdf_document_alter(&$mpdf_object) {
if ($some_condition) {
unset($mpdf_object->HTMLHeader);
unset($mpdf_object->HTMLFooter);
}
}
And etc.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | pdf_using_mpdf_ability-to-alter-mpdf-setting-by-other-modules-2275607-1.patch | 725 bytes | nikita petrov |
Comments
Comment #1
nikita petrov commentedHere is the patch for that functionlity.
Comment #2
nikita petrov commentedComment #3
salnoob commentedAnother option would be to provide a more robust api function that can accept an array of options.
For example, it could take:
Within the code I just added a statement wherever there are 'variable_get' calls. This is a hopefully temporary fix though.
Comment #4
srjoshWorks well for me.
Comment #5
nevergone#2400245: Hooks to alter PDF config/attributes from other modules: Better documentation and API function