Uitvoerformaten
Uitvoerformaten
Uitvoerformaten
Aspose.TeX FOSS voor Python ondersteunt drie uitvoerformaten via verwisselbare uitvoerapparaatklassen. Geef het juiste apparaat door aan TeXJob en roep run() aan om de getypte uitvoer te verkrijgen. PdfDevice retourneert PDF-bytes direct van run(). DviDevice retourneert DVI-bytes van run(). SvgDevice retourneert geen bytes van run() — haal in plaats daarvan per-pagina SVG-byte-strings op met SvgDevice.get_all_pages() nadat run() is voltooid.
PDF via 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 via 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)SVG via 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)Een uitvoerformaat kiezen
| Use Case | Device | Notes |
|---|---|---|
| Afdrukken of delen | PdfDevice | Draagbaar; het meest compatibel |
| Web / vectorafbeeldingen | SvgDevice | Per-pagina SVG via get_all_pages() |
| Traditionele TeX pipeline | DviDevice | DVI-formaat voor downstream-tools |
API Reference Samenvatting
| Klasse | Beschrijving |
|---|---|
PdfDevice | Genereer PDF-uitvoerbytes |
DviDevice | Genereer DVI-uitvoerbytes |
SvgDevice | Genereer per-pagina SVG-uitvoer |
SvgDevice.get_all_pages() | Retourneer lijst van SVG-bytestrings |