Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created October 21, 2025 21:39
Show Gist options
  • Select an option

  • Save aspose-com-gists/564e395261f5cb4805ab5367bdf8d7f2 to your computer and use it in GitHub Desktop.

Select an option

Save aspose-com-gists/564e395261f5cb4805ab5367bdf8d7f2 to your computer and use it in GitHub Desktop.
Convert LaTeX to XPS in Python
from aspose.tex import *
from aspose.tex.io import *
from aspose.tex.presentation.xps import *
import aspose.tex as tex
from os import path
from datetime import datetime
from io import BytesIO
license_path = "license.lic"
# Apply Aspose.Tex license
license = tex.License()
license.set_license(license_path)
# Create conversion options for Object LaTeX format upon Object TeX engine extension.
options = TeXOptions.console_app_options(TeXConfig.object_latex)
# Set interaction mode.
options.interaction = Interaction.NONSTOP_MODE
# Specify the address for the working directory.
options.input_working_directory = InputFileSystemDirectory("input")
options.output_working_directory = OutputFileSystemDirectory("output")
# Initialize an instance of the XpsSaveOptions class.
so = XpsSaveOptions()
options.save_options = so
# Run LaTeX to XPS conversion by calling the run method.
TeXJob("sample.ltx", XpsDevice(), options).run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment