Miten käyttää TeX-moottoria Pythonissa

Miten käyttää TeX-moottoria Pythonissa

Miten käyttää TeX-moottoria Pythonissa

TeXJob on pääsisäänpääpiste Aspose.TeX FOSS-moottorille. se hyväksyy tulonlähde, tuonnin laite ja valinnainen TeXOptions,Sitten juoksemme Pyyhkeiden tyypillinen kun run() Hänet kutsutaan.

Tyypillinen 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)

Tyypillinen 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)

Tyypillinen DVI

from aspose_tex import TeXJob, TeXOptions, DviDevice, StringInputSource

dvi_bytes = TeXJob(StringInputSource("Hello!"), DviDevice(), options=TeXOptions()).run()

See Also

 Suomi