在django中,我使用jinja2将模板呈现为.tex文件。然后我需要对这个.tex文件调用'xelatex',并将输出保存为django file对象。你知道吗
我已经知道了:
tex_file = render_to_string("foo.tex", context)
如果我将tex_file
保存到一个文件中,并在其上运行xelatex,我会得到预期的输出,因此它一直工作到现在。你知道吗
然后我试着这样做:
subprocess.run(["xelatex", tex_file], capture_output=True])
问题是我实际上不想将xelatex的输出捕获到STDOUT。我想抓住输出.pdf它生成的文件。你知道吗
我知道我可以让xelatex将这个文件保存到/tmp/中,然后让python打开它并处理它,但是这看起来很慢而且很混乱。有没有办法让子进程实际返回输出:
output = subprocess.run(["xelatex", tex_file], capture_output=True])
self.file = file
目前没有回答
相关问题 更多 >
编程相关推荐