title: WeasyPrint and Bootstrap
body: <p>So I have a very simple template that I am testing with WeasyPrint. If render the template as a regular webpage it renders just fine.  If I try generatinga PDF the styling dissapears.  The only time the PDF will generate properly is when I remove the bootstrap reference. Does anyone have any thoughts on why styling would not work as soon as I introduce the bootstrap css files? I have tried some Bootstrap3 and Bootstrap2 files. Local and CDN served.</p>
  
  <p>The Template:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  {%  load static from staticfiles %}
  {%  block head %}
      &lt;head&gt;
      {% block css %}
          &lt;link rel="stylesheet" href="{%  static "css/bootstrap.min.css" %}"&gt;
          &lt;link rel="stylesheet" href="{%  static "css/main.css" %}"&gt;
      {% endblock css %}
      &lt;/head&gt;
  {% endblock head %}
  &lt;body&gt;
  {% block content %}
      &lt;div id="content" class="container"&gt;
          &lt;div id="logo" class="col-md-3"&gt;
              &lt;img src="{%  static "images/logo_small.png" %}"&gt;
          &lt;/div&gt;
          &lt;div id="heading" class="col-md-6"&gt;
              &lt;h1&gt;Packing Slip&lt;/h1&gt;
          &lt;/div&gt;
  
          &lt;div class="col-md-3"&gt;
              &lt;h2&gt;{{ packslip_id }}&lt;/h2&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  {% endblock %}
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>My View:</p>
  
  <pre><code>class WeasyPDF(TemplateView):
  template_name = 'jinja2/Shipping/test_pdf.html'
  
  
  def get(self, request, *args, **kwargs):
      packslip_id = kwargs.get('packslip_id')
      context= {'packslip_id': packslip_id }
      template_string = render_to_string(self.template_name, context)
      html = HTML(string=template_string, base_url=request.build_absolute_uri())
      main_doc = html.render()
      pdf = main_doc.write_pdf()
      response = HttpResponse(pdf, content_type='application/pdf')
      #Download as attachment
      # response['Content-Disposition'] = 'attachment; filename=packslip-{0}.pdf'.format(packslip_id)
      # Display in browser
      response['Content-Disposition'] = 'filename=packslip-{0}.pdf'.format(packslip_id)
      return response
  </code></pre>
  
  <p>Finally the urls.py entry</p>
  
  <pre><code>    url(r'^weasypdf/(?P&lt;packslip_id&gt;\d+)$', WeasyPDF.as_view(), name='weasypdf'),
  </code></pre>