1 Star 0 Fork 0

Role/Python

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
basic.py 851 Bytes
一键复制 编辑 原始数据 按行查看 历史
Jérôme Krell 提交于 2019-10-10 20:22 +08:00 . Reformat Code by PyCharm-Community
from fpdf import FPDF
# Author: @NavonilDas
pdf = FPDF()
# Set Author Name of the PDF
pdf.set_author('@NavonilDas')
# Set Subject of The PDF
pdf.set_subject('python')
# Set the Title of the PDF
pdf.set_title('Generating PDF with Python')
pdf.add_page()
# Set Font family Courier with font size 28
pdf.set_font("Courier", '', 18)
# Add Text at (0,50)
pdf.text(0, 50, "Example to generate PDF in python.")
# Set Font Family Courier with italic and font size 28
pdf.set_font("Courier", 'i', 28)
pdf.text(0, 60, "This is an italic text") # Write text at 0,60
# Draw a Rectangle at (10,100) with Width 60,30
pdf.rect(10, 100, 60, 30, 'D')
# Set Fill color
pdf.set_fill_color(255, 0, 0) # Red = (255,0,0)
# Draw a Circle at (10,135) with diameter 50
pdf.ellipse(10, 135, 50, 50, 'F')
# Save the Output at Local File
pdf.output('output.pdf', 'F')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/CRole/Python.git
git@gitee.com:CRole/Python.git
CRole
Python
Python
master

搜索帮助