Mulai Cepat
Petunjuk Cepat
Aspose.TeX FOSS untuk Python mengikuti pola tiga langkah sederhana: buat sumber input, pilih perangkat output, dan panggil TeXJob.run() untuk melakukan penataan. FileInputSource membaca markup TeX dari sebuah file; StringInputSource menerima string dalam memori. PdfDevice mengembalikan byte PDF, DviDevice mengembalikan byte DVI, dan SvgDevice menyimpan data SVG per halaman untuk diambil dengan get_all_pages(). Tidak ada instalasi LaTeX atau file konfigurasi yang diperlukan.
Susun ke PDF
from aspose_tex import TeXJob, TeXOptions, PdfDevice, StringInputSource
source = StringInputSource("Hello, world!")
pdf_bytes = TeXJob(source, PdfDevice(), options=TeXOptions()).run()
with open("output.pdf", "wb") as f:
f.write(pdf_bytes)Susun ke SVG
from aspose_tex import TeXJob, TeXOptions, SvgDevice, StringInputSource
device = SvgDevice()
TeXJob(StringInputSource("Hello!"), device, options=TeXOptions()).run()
svg_pages = device.get_all_pages()
with open("page0.svg", "wb") as f:
f.write(svg_pages[0])Susun ke DVI
from aspose_tex import TeXJob, TeXOptions, DviDevice, StringInputSource
dvi_bytes = TeXJob(StringInputSource("Hello!"), DviDevice(), options=TeXOptions()).run()
with open("output.dvi", "wb") as f:
f.write(dvi_bytes)Susun dari File
from aspose_tex import TeXJob, TeXOptions, PdfDevice, FileInputSource
pdf_bytes = TeXJob(FileInputSource("document.tex"), PdfDevice(), options=TeXOptions()).run()