0

I have an app using django-wkhtmltopdf. It is working locally, but when I run on a VPS I'm getting the following error.

Command '['wkhtmltopdf', '--allow', 'True', '--enable-local-file-access', '--encoding', 'utf8', '--javascript-delay', '2000', '--page-height', '465mm', '--page-width', '297mm', '--quiet', '/tmp/wkhtmltopdffyknjyrk.html', '-']' returned non-zero exit status 1.

I'm guessing I need to set some permissions on the VPS to allow the temp file to be created (or set a directory for it) but I'm not sure how to do this.

Within settings.py I have

WKHTMLTOPDF_CMD_OPTIONS = {
    'quiet': True,
    'allow' : '/tmp',
    'javascript-delay' : 1000,
    'enable-local-file-access' : True,
}

And within the django view I've got:

cmd_options = {
    #'window-status' : 'ready',
    'javascript-delay': 2000,
    'page-height' : '465mm',
    'page-width' : '297mm',
    'allow' : True,
    #'T' : 0, 'R' : 0, 'B' : 0, 'L': 0,
    }
HenryM
  • 5,557
  • 7
  • 49
  • 105

0 Answers0