Formats de sortie

Formats de sortie

Aspose.TeX FOSS pour Python prend en charge trois formats de sortie à travers les classes d’appareil de production interchangeable. Passez le dispositif approprié à TeXJob et appelez run() pour obtenir la sortière du type. PdfDevice retourne des bytes PDF directement de Run(). DviDovice revient des Bytes DVI de run(.). SvgDavice ne remet pas des bits de running() - au lieu, récupérer par page SVG byte lignes utilisant SvdDEVice.get_all_pages() après run () complètes.


PDF par PdfDevice

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)

DVI par DviDevice

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)

M. par SVGDevice

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)

Choisir un format de sortie

Use CaseDeviceNotes
Print or sharePdfDevicePortable; most compatible
Web / vector graphicsSvgDevicePer-page SVG via get_all_pages()
Traditional TeX pipelineDviDeviceDVI format for downstream tools

Le résumé de référence API

ClassDescription
PdfDeviceProduce PDF output bytes
DviDeviceProduce DVI output bytes
SvgDeviceProduce per-page SVG output
SvgDevice.get_all_pages()Return list of SVG byte strings

Voir aussi

  • Référence API
  • Aspose.TeX - Documentation d’entreprise
 Français