python如何创建pdf文件并支持中文reportlab

2024-10-16 13:25:59

1、 参考经验如下,先安装 reportlab插件,

python如何创建pdf文件并支持中文reportlab

3、 将中文字体文件拷贝到项目的根路径下

python如何创建pdf文件并支持中文reportlab

5、 创建代艨位雅剖码如下,该方法可以创建pdf文件def createPdf(pdfName, conte荏鱿胫协nt):c = canvas.Canvas(pdfName, pagesize=letter)# 设置字体c.setFont('song', 14)width, height = lettercontent = content.encode("utf-8")c.drawString(width / 2 - 200, height / 2 + 150, content)c.showPage()c.save()

python如何创建pdf文件并支持中文reportlab

7、 如果您觉得有用,记得在下方点击投票、点赞、关注、留言,小编会定期奉上更多的惊喜哦,您的支持才是小编继续努力的动力,么么哒。

python如何创建pdf文件并支持中文reportlab
猜你喜欢