Commit a11de1f7 authored by jcnventura's avatar jcnventura

Fix #578990: enable tokens in the wkhtmltopdf options string

parent b616ca31
......@@ -193,7 +193,7 @@ function print_pdf_settings() {
'#type' => 'textfield',
'#title' => t('wkhtmltopdf options'),
'#default_value' => variable_get('print_pdf_wkhtmltopdf_options', PRINT_PDF_WKHTMLTOPDF_OPTIONS),
'#description' => t('(wkhtmltopdf only) Set any additional options to be passed to the wkhtmltopdf executable.'),
'#description' => t('(wkhtmltopdf only) Set any additional options to be passed to the wkhtmltopdf executable. Tokens may be used in these options (see list below).'),
);
$form['settings']['print_pdf_xvfb_options'] = array(
'#type' => 'textfield',
......
......@@ -297,6 +297,10 @@ function _print_pdf_wkhtmltopdf($print, $html, $filename) {
$xprocess = proc_open($xcmd, $xdescriptor, $xpipes, NULL, NULL);
}
if (function_exists('token_replace') && !empty($print_pdf_wkhtmltopdf_options)) {
$print_pdf_wkhtmltopdf_options = token_replace($print_pdf_wkhtmltopdf_options, 'node', $print['node']);
}
$descriptor = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
$cmd = realpath($print_pdf_pdf_tool) . " --page-size $print_pdf_paper_size --orientation $print_pdf_page_orientation --dpi $dpi $print_pdf_wkhtmltopdf_options - -";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment