summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoao Ventura2009-10-06 23:41:54 (GMT)
committer Joao Ventura2009-10-06 23:41:54 (GMT)
commitcffa84f881102ba91f191d999331ac47c0d45ea5 (patch)
tree3a8820387a68d4100424734f6490059e32103879
parent38ffb336ed45a1f6a1e75489e402c13ef6ac861b (diff)
Fix #578990: enable tokens in the wkhtmltopdf options string
-rw-r--r--print_pdf/print_pdf.admin.inc2
-rw-r--r--print_pdf/print_pdf.pages.inc4
2 files changed, 5 insertions, 1 deletions
diff --git a/print_pdf/print_pdf.admin.inc b/print_pdf/print_pdf.admin.inc
index f6995d5..46b877b 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 c804e3d..1e84ba2 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 - -";