PythonでTeXエンジンを使用する方法
Python で TeX エンジンを使用する方法
TeXJob は Aspose.TeX FOSS エンジンの主要エントリーポイントです。入力ソース、出力デバイス、オプションの TeXOptions を受け取り、run() が呼び出されたときに組版パイプラインを実行します。
PDF に組版
from aspose_tex import TeXJob, TeXOptions, PdfDevice, StringInputSource
pdf_bytes = TeXJob(StringInputSource("Hello!"), PdfDevice(), options=TeXOptions()).run()
with open("output.pdf", "wb") as f:
f.write(pdf_bytes)SVG に組版
from aspose_tex import TeXJob, TeXOptions, SvgDevice, StringInputSource
device = SvgDevice()
TeXJob(StringInputSource("Hello!"), device, options=TeXOptions()).run()
for i, svg in enumerate(device.get_all_pages()):
with open(f"page_{i}.svg", "wb") as f:
f.write(svg)DVI に組版
from aspose_tex import TeXJob, TeXOptions, DviDevice, StringInputSource
dvi_bytes = TeXJob(StringInputSource("Hello!"), DviDevice(), options=TeXOptions()).run()