'Get a list of fields, if the list_fields attribute is provided
then use that to extract the fields that are required, otherwise
use the list of readable fields.'

def get_resource_flowable(self, resource, doc):

    fields = self.list_fields
    if fields:
        list_fields = [f for f in fields if (f != 'id')]
    else:
        list_fields = [f.name for f in resource.readable_fields() if (((f.type != 'id') and (f.name != 'comments')) or (not self.pdf_hide_comments))]
    get_vars = Storage(current.request.get_vars)
    get_vars['iColumns'] = len(list_fields)
    (filter, orderby, left) = resource.datatable_filter(list_fields, get_vars)
    resource.add_filter(filter)
    result = resource.select(list_fields, left=left, limit=None, count=True, getids=True, orderby=orderby, represent=True, show_links=False)
    pdf_table = S3PDFTable(doc, result['rfields'], result['rows'], groupby=self.pdf_groupby, autogrow=self.table_autogrow, body_height=doc.body_height).build()
    return pdf_table
