function _print_pdf_wkhtmltopdf_version in Printer, email and PDF versions 5.x
Same name and namespace in other branches
- 5.4 print_pdf/print_pdf.module \_print_pdf_wkhtmltopdf_version()
- 6 print_pdf/print_pdf.module \_print_pdf_wkhtmltopdf_version()
- 7 print_pdf/print_pdf.module \_print_pdf_wkhtmltopdf_version()
2 calls to _print_pdf_wkhtmltopdf_version()
- print_pdf_requirements in print_pdf/
print_pdf.module - Implementation of hook_requirements().
- _print_pdf_wkhtmltopdf in print_pdf/
print_pdf.pages.inc - Generate the PDF file using wkhtmltopdf
File
- print_pdf/
print_pdf.module, line 588 - Displays Printer-friendly versions of Drupal pages.
Code
function _print_pdf_wkhtmltopdf_version() {
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
$descriptor = array(
0 => array(
'pipe',
'r',
),
1 => array(
'pipe',
'w',
),
2 => array(
'pipe',
'w',
),
);
$cmd = realpath($print_pdf_pdf_tool) . ' --version';
$process = proc_open($cmd, $descriptor, $pipes, NULL, NULL);
if (is_resource($process)) {
$out = preg_match('!.*?(\\d+\\.\\d+\\.\\d+).*$!m', stream_get_contents($pipes[1]), $matches);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
$retval = proc_terminate($process);
}
return $matches[1];
}