Skip to content

Commit 1b96ee6

Browse files
committed
Merge pull request JazzCore#15 from mmarchini/xserver_notification
Notification when wkhtmltopdf can't connect to X server
2 parents c40ef82 + 100fe43 commit 1b96ee6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pdfkit/pdfkit.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ def to_pdf(self, path=None):
106106

107107
exit_code = result.returncode
108108

109+
if 'cannot connect to X server' in stderr.decode('utf-8'):
110+
raise IOError('%s\n'
111+
'You will need to run whktmltopdf within a "virutal" X server.\n'
112+
'Go to the link above for more information\n'
113+
'https://github.com/JazzCore/python-pdfkit/wiki/Using-wkhtmltopdf-without-X-server' % stderr.decode('utf-8'))
114+
109115
if 'Error' in stderr.decode('utf-8'):
110116
raise IOError('wkhtmltopdf reported an error:\n' + stderr.decode('utf-8'))
111117

0 commit comments

Comments
 (0)