title: Why django library xhtml2pdf returning an error?
body: <p>I am using xhtml2pdf library in drf viewset to generate a pdf document from an html template that lists all records from a given model. Below is the action that I have defined inside my vieset</p>
  <pre><code>@action(detail=False)
  def pdf(self, request, *args, **kwargs):
      import datetime
      filter = self.filter_queryset(Ledger.objects.values_list('name','groupid__name','panno', gstin'))
      pdf_obj = render_to_pdf('reports/report.html', {'data': filter})
      if pdf_obj:
          response = HttpResponse(pdf_obj, content_type='application/pdf')
          filename = 'Ledgers-' + str(datetime.date.today()) + '.pdf'
          content = &quot;inline; filename=%s&quot; % (filename)
          download = request.GET.get(&quot;download&quot;)
          if download:
              content = &quot;attachment; filename=%s&quot; % (filename)
          response['Content-Disposition'] = content
          return response
  </code></pre>
  <p>This results in ValueError exception with following message</p>
  <blockquote>
  <p>&lt;PmlTable@0x7F7C4304B390 2 rows x 0 cols&gt;... must have at least a row and column</p>
  </blockquote>
  <p>I am clueless what am I doing wrong here, Please advise.</p>