Formatos de salida

Formatos de salida

Aspose.TeX FOSS for Python supports three output formats through interchangeable output device classes. Pass the appropriate device to TeXJob and call run() to obtain the typeset output. PdfDevice returns PDF bytes directly from run(). DviDevice returns DVI bytes from run(). SvgDevice does not return bytes from run() — instead, retrieve per-page SVG byte strings using SvgDevice.get_all_pages() after run() completes.


PDF por medio de 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 a través de 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)

El SGV por el 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)

Elegir un formato de salida

Uso de casoDispositivoNotas
Impresión o compartirPdfDevicePortable: más compatible
Web / gráficos vectorSvgDevicePor página SVG por medio de get_all_pages()
Pipe tradicional de TeXDviDeviceFormato DVI para herramientas de descenso

Sumación de referencia API

claseDescripción
PdfDeviceProducir bajas de salida PDF
DviDeviceProducción de bajas de producción DVI
SvgDeviceProducir por página SVG
SvgDevice.get_all_pages()Lista de retorno de las líneas SVG byte

Ver también

 Español