'Generate a PDF of a Request Form'

@staticmethod
def req_form(r, **attr):

    db = current.db
    table = db.req_req
    record = db((table.id == r.id)).select(limitby=(0, 1)).first()
    if (record.type == 1):
        pdf_componentname = 'req_item'
        list_fields = ['item_id', 'item_pack_id', 'quantity', 'quantity_commit', 'quantity_transit', 'quantity_fulfil']
    elif (record.type == 3):
        pdf_componentname = 'req_skill'
        list_fields = ['skill_id', 'quantity', 'quantity_commit', 'quantity_transit', 'quantity_fulfil']
    else:
        redirect(URL(args=current.request.args[0], extension='pdf'))
    if current.deployment_settings.get_req_use_req_number():
        filename = record.req_ref
    else:
        filename = None
    from s3.s3export import S3Exporter
    exporter = S3Exporter().pdf
    return exporter(r.resource, request=r, method='list', pdf_title=current.deployment_settings.get_req_form_name(), pdf_filename=filename, list_fields=list_fields, pdf_hide_comments=True, pdf_componentname=pdf_componentname, pdf_header_padding=12, pdf_table_autogrow='B', pdf_paper_alignment='Landscape', **attr)
