function _print_pdf_wkhtmltopdf_version in Printer, email and PDF versions 6
Same name and namespace in other branches
- 5.4 print_pdf/print_pdf.module \_print_pdf_wkhtmltopdf_version()
- 7 print_pdf/print_pdf.module \_print_pdf_wkhtmltopdf_version()
- 5.x print_pdf/print_pdf.module \_print_pdf_wkhtmltopdf_version()
Find out the version of the wkhtmltopdf library
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 673 - 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)) {
$content = stream_get_contents($pipes[1]);
$out = preg_match('!.*?(\\d+\\.\\d+\\.\\d+).*$!m', $content, $matches);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
$retval = proc_close($process);
}
return $matches[1];
}