Snelstart

Overzicht

Aspose.TeX FOSS voor Python volgt een eenvoudig patroon van drie stappen: maak een invoerbron, kies een uitvoerapparaat, en roep TeXJob.run() aan om het opmaken uit te voeren. FileInputSource leest TeX markup uit een bestand; StringInputSource accepteert strings in het geheugen. PdfDevice geeft PDF-bytes terug, DviDevice geeft DVI-bytes terug, en SvgDevice slaat per-pagina SVG-gegevens op voor ophalen met get_all_pages(). Geen LaTeX installatie of configuratiebestand is vereist.


Opmaak naar 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)

Opmaak naar 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])

Opmaak naar 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)

Opmaak vanuit een bestand

from aspose_tex import TeXJob, TeXOptions, PdfDevice, FileInputSource

pdf_bytes = TeXJob(FileInputSource("document.tex"), PdfDevice(), options=TeXOptions()).run()

Volgende stappen

Zie ook

 Nederlands