python使用fpdf创建pdf:写入hello world嵌入图片

Posted Data+Science+Insight

tags:

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

python使用fpdf创建pdf:写入hello world、嵌入图片

pip install 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.image('example.jpg', 10, 30, 100)
pdf.output('example2.pdf', 'F')

 参考:fpdf

参考:How to Create a PDF in Python

参考:PyFPDF Documentation

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

python使用FPDF包将多个图像文件写入pdf文件实战

python使用fpdf生成pdf文件:配置多种语言字体写入多种文字

python使用fpdf将生成的长字符串手动换行写入pdf

python使用fpdf创建pdf文件包含:页眉页脚并嵌入logo图片设置使用中文字体

python使用fpdf创建页眉页脚并嵌入图片

python使用fpdf生成数据报告pdf文件