---
Product: Aspose.TeX
Platform: python
Page Type: index
Canonical URL: https://products.aspose.org/tex/python/
---

# Aspose.TeX FOSS for Python

Free, MIT-licensed Python library to produce PDF, DVI, and SVG output from TeX markup. No LaTeX runtime required.

Aspose.TeX FOSS for Python is a free, MIT-licensed TeX engine that produces PDF, DVI, and SVG output from TeX input. Install with pip. No external runtime required.

## Aspose.TeX FOSS — Open Source Python TeX Engine

Aspose.TeX FOSS for Python (aspose-tex) is a free, MIT-licensed TeX typesetting engine
for Python developers. It generates PDF,
DVI, or SVG output — no LaTeX installation or external runtime required.

The library exposes three output devices: `PdfDevice` for PDF output, `DviDevice` for
DVI output, and `SvgDevice` for multi-page SVG output. The `TeXJob` class is the main
entry point; it accepts a `FileInputSource` or `StringInputSource` and an output device,
then runs the typesetting engine when `.run()` is called.

Aspose.TeX FOSS for Python is released under the MIT license. It runs in Python 3.10+
environments on all major operating systems including Linux, macOS, and Windows. No
Ghostscript or TeX Live dependency required. For the enterprise product, see [Aspose.TeX for Python — Enterprise Product](https://products.aspose.com/tex/python-net/).

```bash
pip install aspose-tex-foss
```

## PDF and DVI Output

- `PdfDevice` wraps `PdfWriter` to produce PDF 1.4 output bytes
- `DviDevice` wraps `DviWriter` for DVI output
- `TeXJob.run()` returns `bytes` or writes to a `Path` or `BytesIO`
- In-memory processing — no temporary files required

## Use cases

- Typeset math equations and technical documents to PDF
- Generate print-ready output from TeX source
- Batch-convert TeX files in CI/CD pipelines
- Produce DVI for downstream tooling

## SVG Output

- `SvgDevice` wraps `SvgWriter` for SVG 1.1 multi-page output
- `get_bytes()` returns SVG bytes for single-page documents
- `get_all_pages()` returns a list of bytes for multi-page documents
- Clean vector output for web and display use

## Use cases

- Render TeX equations as inline SVG for web pages
- Export typeset figures to scalable vector format
- Generate diagrams and mathematical notation
- Serve SVG output from APIs and web services

## Flexible Input Sources

- `StringInputSource` — provide TeX markup as a Python string
- `FileInputSource` — read TeX source from a file path on disk
- `InputSource` — abstract base class implemented by both input types
- `TeXOptions.load_format` — control format pre-loading

## Use cases

- Process dynamically-generated TeX markup in memory
- Convert TeX files from disk in batch workflows
- Integrate TeX rendering into web applications
- Chain TeX processing with other data pipelines

## Engine Configuration

- `TeXOptions.job_name` — set the job name used in log messages and default output filenames
- `TeXOptions.magnification` — control the TeX magnification factor
- `TeXOptions.extra_font_paths` — extend the font search path with custom directories
- `TeXOptions.extra_format_paths` — extend the search path for format and `\input` files

## Use cases

- Tune output filenames and log messages per job
- Adjust document magnification for print or display targets
- Use custom TFM/PFB fonts alongside the bundled Computer Modern fonts
- Organize multi-file TeX projects with additional input search paths

## Process TeX to PDF

Install the package (see above), then typeset a TeX string to obtain PDF bytes:

```python
from aspose_tex import StringInputSource, PdfDevice, TeXJob, TeXOptions
opts = TeXOptions(load_format=False)
result = TeXJob(
    StringInputSource(r"Hello -- done"),
    PdfDevice(),
    options=opts,
).run()
# result is bytes containing a valid PDF
```

## Process TeX File to SVG

Read TeX source from a file and export each page as SVG:

```python
from aspose_tex import FileInputSource, SvgDevice, TeXJob, TeXOptions
opts = TeXOptions(load_format=False)
device = SvgDevice()
TeXJob(FileInputSource("input.tex"), device, options=opts).run()
pages = device.get_all_pages()  # list[bytes] of SVG per page
```

## Export TeX to DVI

Use `DviDevice` to produce DVI output:

```python
from aspose_tex import StringInputSource, DviDevice, TeXJob, TeXOptions
opts = TeXOptions(load_format=False)
result = TeXJob(
    StringInputSource(r"\hbox{Test}-- done"),
    DviDevice(),
    options=opts,
).run()
# result is bytes containing DVI data
```

## Frequently Asked Questions

### What is the licensing model?

Aspose.TeX FOSS for Python is published under the MIT license. Commercial use is permitted without fees or restrictions.

### Are there any native dependencies?

No. It is a pure Python package requiring no LaTeX installation, Perl runtime, or external TeX distribution.

### Which output formats are supported?

PDF (`PdfDevice`), DVI (`DviDevice`), and SVG (`SvgDevice`). Input is TeX markup from a file or string.

### How do I produce PDF output?

Use `TeXJob(StringInputSource(content), PdfDevice(), options=TeXOptions()).run()` to receive PDF bytes.

### Can I read TeX from an in-memory string?

Yes. Use `StringInputSource` to pass TeX markup directly without writing to disk.

## Support and Learning Resources

- [Documentation](https://docs.aspose.org/tex/python/)
- [API References](https://reference.aspose.org/tex/python/)
- [Free Support](https://forum.aspose.org/)
- [Contribution](https://contribution.aspose.org/)
- [Blog](https://blog.aspose.org/)
- [New Releases](https://releases.aspose.org/)