- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有人知道当我使用 SimpleDocTemplate() 制作 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)
关于python - 如何摆脱 SimpleDocTemplate() 中的间距。 Python。报告实验室,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3374296/
您好,我是报告实验室的新手。我想生成一份包含表格的 pdf 报告。表格中的某些列文本大于列宽,现在我想根据列宽换行文本。 以下是我编写的代码 # Imports from reportlab.pdfg
我正在使用 Reportlab SimpleDocTemplate 创建一个 pdf 文件。我必须按行写入(绘制)多个图像,以便我可以调整文件中的多个图像。 class PrintBarCodes(V
我正在使用 ReportLab 生成 PDF 报告。 我使用了 SimpleDocTemplate 并设置了 pageSize = A5。但是在构建PDF后,当我打开创建的文件时,页面大小为A4。 d
我有一个 django 应用程序,它当前使用用户可以下载的 Canvas 生成 pdf。我创建了一个 StringIO 缓冲区,做一些事情然后发送调用 response.write。 # Set up
有人知道当我使用 SimpleDocTemplate() 制作 PDF 文档时是否可以删除默认间距。 我希望它从一个角打印到另一个角。 response = HttpResponse(mimet
有人知道当我使用 SimpleDocTemplate() 制作 PDF 文档时是否可以删除默认间距。 我希望它从一个角打印到另一个角。 response = HttpResponse(mimet
我正在使用 Python 2.7.6 和 Django 1.5.5。如何在 SimpleDocTemplate 中写入一行? 我正在尝试这个: @login_required def report(r
我正在生成一个 PDF,但我无法为不同的页面提供不同的上边距。 有没有什么方法或者途径可以解决这个问题? response = HttpResponse(mimetype='application/p
//这里使用simpledoctemplate创建pdf。我无法将图像带到页面顶部。请给出解决方案 def report_creator(): styles = getSampleStyleS
我正在使用 django 并在 this example 之后生成报告, 我需要生成最后一页但没有页眉或页脚和不同的内容。 我正在尝试这样做: def print_example(self):
我是一名优秀的程序员,十分优秀!