صيغ المخرجات

صيغ المخرجات

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 عبر 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 عبر جهاز 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)

SVG عبر 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)

اختيار شكل الناتج

حالة الاستخدامالجهازملاحظات
طباعة أو مشاركةPdfDeviceمحمولة، متوافقة معظمها
رسومات ويب / متجهةSvgDeviceفي كل صفحة عبر SVG get_all_pages()
خط أنابيب TeX التقليديDviDeviceتنسيق DVI للأدوات التالية للجريان

إشارة API

الفئةوصف
PdfDeviceإنتاج بايتات الصورة PDF للخروج
DviDeviceإنتاج بايتات DVI للخروج
SvgDeviceإنتاج خروج SVG لكل صفحة
SvgDevice.get_all_pages()قائمة إرجاع سلاسل بايت SVG

انظر أيضا

 العربية