我需要创建一些LaTeX数据的pdf文件。我所拥有的:
min_latex = (r"\documentclass{article}"
r"\begin{document}"
r"Hello, world!"
r"\end{document}")
from latex import build_pdf
# this builds a pdf-file inside a temporary directory
pdf = build_pdf(min_latex)
# look at the first few bytes of the header
print bytes(pdf)[:10]
with open('temp.pdf', 'wb+') as f:
f.write(pdf)但是,我有以下错误消息:
File "temp.py", line 18, in <module> f.write(pdf) TypeError: argument 1 must be convertible to a buffer, not Data发布于 2017-03-30 14:48:16
pdf不是字符串-您必须调用它的一个方法来保存它:
pdf.save_to("/tmp/foo.pdf")一般来说,最好进入交互式解释器并粘贴到程序中,直到包含pdf =.线路。然后你可以说help(pdf)来找出你能用这个对象做什么。
https://stackoverflow.com/questions/43119129
复制相似问题