python使用fpdf创建pdf并写入hello world

Posted Data+Science+Insight

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python使用fpdf创建pdf并写入hello world相关的知识,希望对你有一定的参考价值。

python使用fpdf创建pdf并写入hello world

from fpdf import FPDF

# 创建pdf并写入hello world文本内容;

from fpdf import FPDF

pdf = FPDF()
pdf.add_page()
pdf.set_font('Arial', 'B', 16)
pdf.cell(40, 10, 'Hello World!')
pdf.output('example1.pdf', 'F')

 参考:fpdf

参考:How to Create a PDF in Python

参考:PyFPDF Documentation

以上是关于python使用fpdf创建pdf并写入hello world的主要内容,如果未能解决你的问题,请参考以下文章