function _print_pdf_dompdf in Printer, email and PDF versions 5.3
Same name and namespace in other branches
- 5.4 print_pdf/print_pdf.pages.inc \_print_pdf_dompdf()
- 6 print_pdf/print_pdf.pages.inc \_print_pdf_dompdf()
- 7 print_pdf/print_pdf.pages.inc \_print_pdf_dompdf()
- 5.x print_pdf/print_pdf.pages.inc \_print_pdf_dompdf()
Generate the PDF file using the dompdf library
Parameters
$print: array containing the configured data
$html: contents of the post-processed template already with the node data
$filename: name of the PDF file to be generated
See also
1 call to _print_pdf_dompdf()
- print_pdf_controller in print_pdf/
print_pdf.pages.inc - Generate a PDF version of the printer-friendly page
File
- print_pdf/
print_pdf.pages.inc, line 79
Code
function _print_pdf_dompdf($print, $html, $filename) {
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
$print_pdf_paper_size = variable_get('print_pdf_paper_size', PRINT_PDF_PAPER_SIZE_DEFAULT);
$print_pdf_page_orientation = variable_get('print_pdf_page_orientation', PRINT_PDF_PAGE_ORIENTATION_DEFAULT);
$print_pdf_content_disposition = variable_get('print_pdf_content_disposition', PRINT_PDF_CONTENT_DISPOSITION_DEFAULT);
require_once $print_pdf_pdf_tool;
// dompdf seems to have problems with something in system.css so let's not use it
$html = preg_replace('!<link.*?modules/system/system.css.*?/>!', '', $html);
$url_array = parse_url($print['url']);
$protocol = $url_array['scheme'] . '://';
$host = $url_array['host'];
$path = dirname($url_array['path']) . '/';
$dompdf = new DOMPDF();
$dompdf
->set_base_path($path);
$dompdf
->set_host($host);
$dompdf
->set_paper(drupal_strtolower($print_pdf_paper_size), $print_pdf_page_orientation);
$dompdf
->set_protocol($protocol);
$html = theme('print_pdf_dompdf_footer', $html);
$dompdf
->load_html($html);
$dompdf
->render();
$dompdf
->stream($filename, array(
'Attachment' => $print_pdf_content_disposition == 2,
));
}