aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.rst10
-rw-r--r--wkhtmltopdf/utils.py9
2 files changed, 16 insertions, 3 deletions
diff --git a/README.rst b/README.rst
index ee7a099..925f543 100644
--- a/README.rst
+++ b/README.rst
@@ -34,3 +34,13 @@ specific execuatable:
e.g.: in ``settings.py``::
WKHTMLTOPDF_CMD = '/path/to/my/wkhtmltopdf'
+
+You may also set
+``WKHTMLTOPDF_CMD_OPTIONS``
+in ``settings.py`` to a dictionary of default command-line options.
+
+The default is::
+
+ WKHTMLTOPDF_CMD_OPTIONS = {
+ 'quiet': True,
+ }
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py
index ce32621..7fe432a 100644
--- a/wkhtmltopdf/utils.py
+++ b/wkhtmltopdf/utils.py
@@ -1,5 +1,6 @@
from __future__ import absolute_import
+from copy import copy
from itertools import chain
from os import fdopen
import sys
@@ -56,9 +57,11 @@ def wkhtmltopdf(pages, output=None, **kwargs):
output = '-'
# Default options:
- options = {
- 'quiet': True,
- }
+ options = getattr(settings, 'WKHTMLTOPDF_CMD_OPTIONS', None)
+ if options is None:
+ options = {'quiet': True}
+ else:
+ options = copy(options)
options.update(kwargs)
cmd = getattr(settings, 'WKHTMLTOPDF_CMD', 'wkhtmltopdf')