小编ash*_*tla的帖子

python中fpdf的文本换行问题

我已经使用 pyfpdf 模块生成了 PDF 文件,但我注意到每行中的文本未正确对齐。

我需要在单元格中进行文本换行才能自动调整。我尝试使用下面的代码生成固定大小的 PDF 文件,但它无法将文本混合在行中,您可以检查评论中的屏幕截图来查看问题。

我需要动态调整表列大小。请帮忙。

代码 :


pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", size=8)

item_data = [['Item Name', 'Last clock', 'lastvalue'], ['cl Loaded Class Count', '0', '0'], ['cl Total Loaded Class Count', '0', '0'], ['cl Unloaded Class Count', '0', '0'], ['comp Name of the current JIT compiler', '0', ''], ['comp Accumulated time spent in compilation', '0', '0'], ['gc ConcurrentMarkSweep number of collections per second', '0', '0'], ['gc ConcurrentMarkSweep accumulated time spent in collection', '0', '0'], ['gc Copy …
Run Code Online (Sandbox Code Playgroud)

python

7
推荐指数
1
解决办法
4186
查看次数

标签 统计

python ×1