pdfkit does not load css and JavaScript pdfkit does not load css and JavaScript flask flask

pdfkit does not load css and JavaScript


To generate URLs for static files, use the special 'static' endpoint name: http://flask.pocoo.org/docs/0.10/quickstart/#static-files

<link href="{{ url_for('static', filename='css/bootstrap.css') }}" rel="stylesheet" ><link href="{{ url_for('static', filename='css/bootstrap-theme.css') }}" rel="stylesheet">

Update:Using _external=True may also fix the issue by providing an absolute url. eg:

<link href="{{ url_for('static', filename='css/bootstrap.css', _external=True) }}" rel="stylesheet" >


I was able to get this to work using pdfkit by including the full path in my jinja2 template:

<link rel="stylesheet" href="file:///Users/paul/code/pdfmaker/templates/css/styles.css">