Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在SimpleDoctTemplate()中消除间距。python报告实验室_Python_Django_Pdf Generation - Fatal编程技术网

如何在SimpleDoctTemplate()中消除间距。python报告实验室

如何在SimpleDoctTemplate()中消除间距。python报告实验室,python,django,pdf-generation,Python,Django,Pdf Generation,有人知道当我使用SimpleDoctTemplate()制作PDF文档时,是否可以删除默认跨距 我想把它从一个角落打印到另一个角落 response = HttpResponse(mimetype='application/pdf') response['Content-Disposition'] = 'attachment; filename=somefilename.pdf' # Our container for 'Flowable' objects ele

有人知道当我使用SimpleDoctTemplate()制作PDF文档时,是否可以删除默认跨距

我想把它从一个角落打印到另一个角落

   response = HttpResponse(mimetype='application/pdf')
    response['Content-Disposition'] = 'attachment; filename=somefilename.pdf'

    # Our container for 'Flowable' objects
    elements = []

    # A large collection of style sheets pre-made for us
    styles = getSampleStyleSheet()

    # A basic document for us to write to 'rl_hello_table.pdf'
    doc = SimpleDocTemplate(response)

    #    elements.append(Paragraph("Wumpus vs Cave Population Report",
#    styles['Title']))

    data = [
           ['Deep Ditch',    50],
           ['Death Gully',   5000],
           ['Dire Straits', 600],
           ['Deadly Pit',    5],
           ['Deep Ditch',    50],
           ['Deep Ditch',    50],
           ['Death Gully',   5000],
           ['Dire Straits', 600],
           ['Deadly Pit',    5],
           ['Deep Ditch',    50],
                                  ]

    # Create the table with the necessary style, and add it to the
    # elements list.
    table = Table(data, colWidths=270, rowHeights=70)
    elements.append(table)

    # Write the document to response
    doc.build(elements) 

    return response
尝试:

尝试:

doc = SimpleDocTemplate(response, rightMargin=0, leftMargin=0, topMargin=0, bottomMargin=0)