function print_pdf_wkhtmltopdf_print_pdf_available_libs_alter in Printer, email and PDF versions 7.2
Implements hook_print_pdf_available_libs_alter().
File
- print_pdf/
lib_handlers/ print_pdf_wkhtmltopdf/ print_pdf_wkhtmltopdf.module, line 96 - Generate a PDF for the print_pdf module using the wkhtmltopdf library.
Code
function print_pdf_wkhtmltopdf_print_pdf_available_libs_alter(&$pdf_tools) {
module_load_include('inc', 'print', 'includes/print');
$tools = _print_scan_libs('wkhtmltopdf', '!^wkhtmltopdf!');
// See if there is a binary version of wkhtmltopdf available.
if (drupal_substr(php_uname('s'), 0, 3) !== 'Win') {
exec('export PATH="$PATH:/usr/local/bin" ; which wkhtmltopdf', $binary_output, $binary_status);
if (count($binary_output) > 0 && $binary_status == 0) {
$tools[] = $binary_output[0];
}
}
foreach ($tools as $tool) {
$version = print_pdf_wkhtmltopdf_pdf_tool_version($tool, TRUE);
$pdf_tools['print_pdf_wkhtmltopdf|' . $tool] = 'wkhtmltopdf ' . $version . ' (' . $tool . ')';
}
}