I have a custom module that provides a path that sends an email (mimemail) with a pdf attachment generated from the print_pdf module that comes with the print module.
Here is what my HOOK_mail function looks like.
function custom_send_email_mail($key, &$message, $params) { $node = $params['node']; $user = $params['user']; $message['subject'] = t($node->title.' attached'); $message['body'] = 'Hello '.$user->name.'<br><br>Please find '.$node->title.' attached.'; //$message['params']['attachments'][] = $attachment; module_load_include('inc', 'print_pdf', 'print_pdf.pages'); $attachment = array( 'filecontent' => print_pdf_generate_path($node->nid), 'filemime' => 'application/pdf', 'filename' => $node->title.'.pdf', ); $message['params']['attachments'][] = $attachment; }
The problem I have is that the pdf versions of pages use a template file, which works fine when navigating to the pdf version url, ie. /printpdf/nid but when getting the pdf file string with the (silly named) print_pdf_generate_path() function, it does not use the template file.