function commerce_billy_pdf_dompdf in Commerce Billy 7
DOMPDF converter
1 call to commerce_billy_pdf_dompdf()
- commerce_billy_pdf_output in modules/
commerce_billy_pdf/ commerce_billy_pdf.module - Transforms HTML to PDF and outputs it to the browser.
File
- modules/
commerce_billy_pdf/ commerce_billy_pdf.module, line 261 - Commerce Billy module file.
Code
function commerce_billy_pdf_dompdf($html, $filename, $as_file = FALSE) {
$dompdf = commerce_billy_pdf_prepare_dompdf($html, $filename);
if ($dompdf) {
try {
if ($as_file) {
$filecontent = $dompdf
->output();
return $filecontent;
}
else {
return $dompdf
->stream($filename, array(
'Attachment' => TRUE,
));
}
} catch (\Dompdf\Exception $e) {
drupal_set_message(t('Error generating PDF invoice. Please contact the website administrator.'), 'error');
watchdog('commerce_billy_pdf', 'DOMPDF exception while generating pdf invoice: %message', array(
'%message' => $e
->getMessage(),
), WATCHDOG_ERROR);
return '';
}
}
}