对不起,..我是python中的菜鸟..
我需要创建一个 pdf 文件,而不使用现有的 pdf 文件..(纯粹创建一个新文件)
我有谷歌搜索,其中很多是合并 2 pdf 或从另一个文件中的特定页面创建新文件副本.. .我想要实现的是制作一个报告页面(在图表中),但对于第一步或简单的“如何将字符串插入我的pdf文件?(你好世界mybe)”..
这是我用一个空白页制作一个新的pdf文件的代码
from pyPdf import PdfFileReader, PdfFileWriter
op = PdfFileWriter()
# here to add blank page
op.addBlankPage(200,200)
#how to add string here, and insert it to my blank page ?
ops = file("document-output.pdf", "wb")
op.write(ops)
ops.close()