在 Windows 中将 .tex 文件转换为 .pdf 文件

问题描述 投票:0回答:1

如何使用python编程在windows中将.tex文件转换为.pdf文件?

我有 .tex 文件,想在 Windows 中通过 python 代码生成 .pdf 文件

python-3.x pdf latex pdflatex tex
1个回答
0
投票
import pdflatex
with open('my_file.tex', 'rb') as f:
   pdfl = pdflatex.PDFLaTeX.from_binarystring(f.read(), 'my_file'  
pdf, log, cp = pdfl.create_pdf()

参考:https://pypi.org/project/pdflatex/

© www.soinside.com 2019 - 2024. All rights reserved.