diff --git a/print_pdf/print_pdf.admin.inc b/print_pdf/print_pdf.admin.inc index f6995d5b28b82b020d91795bb81ab17dea481df1..46b877b2d8e2dc0b2ead222312c4a39dbb7a741c 100644 --- a/print_pdf/print_pdf.admin.inc +++ b/print_pdf/print_pdf.admin.inc @@ -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', diff --git a/print_pdf/print_pdf.pages.inc b/print_pdf/print_pdf.pages.inc index c804e3daee56de7ba0d9c5f6ca806bb7fd6a8339..1e84ba2899d3990276fbe0939f9dbac67e36be9b 100644 --- a/print_pdf/print_pdf.pages.inc +++ b/print_pdf/print_pdf.pages.inc @@ -281,6 +281,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 - -";