Aspose.Page FOSS for Python is a free, open-source library for converting PostScript (PS),
Encapsulated PostScript (EPS), and XPS documents in Python applications. Install it with a
single pip install aspose-page-foss command and start exporting documents to PDF and
raster images without any proprietary runtime or system dependency.
The library exposes a clean API built around PsDocument and XpsDocument. Load a document
with from_file() or from_bytes(), then call to_pdf() to obtain a PDF byte stream, or
to_image() with an ImageSaveOptions instance to render to PNG or JPEG at a specified DPI.
An optional MCP server exposes ps_to_pdf, ps_to_image, xps_to_pdf, and xps_to_image
as remote conversion tools using FastMCP.
Because the library has no dependency on native Office libraries or Ghostscript, it runs identically on Windows, Linux, and macOS, including CI runners and Docker containers. The codebase is MIT-licensed and hosted on GitHub. Developers who need the full commercial API can use Aspose.Page for Python alongside these open-source resources. For the enterprise product family, see Aspose.Page — Enterprise Product Family.
PsDocument.from_file() then to_pdf() to export the document as a PDF byte array.PsDocument.from_file() accepts both .ps and .eps file extensions.ImageSaveOptions(format="png", dpi=150) to to_image() for PNG or JPEG output.bytes — no temporary files required.PsDocument.from_bytes() to process PS/EPS data from a network stream or upload.XpsDocument.from_file() then to_pdf() to export the XPS file as a PDF byte array.to_image() with ImageSaveOptions to render XPS pages to PNG or JPEG.XpsDocument.from_bytes() for in-memory XPS data from uploads or streams.add_page(), get_page(), and remove_page() to work with individual pages.XpsPackage.from_file() to inspect raw XPS package parts.create_server() registers ps_to_pdf, ps_to_image, xps_to_pdf, and xps_to_image as MCP tools via FastMCP.eps_metadata tool extracts bounding box and DSC header fields from EPS files.McpInput accepts a file path or base64-encoded bytes; McpOutput returns base64 bytes or writes to a path.McpConversionOptions controls output format and DPI for image conversions.RenderDocument with begin_page(), add_path(), add_text(), add_image(), and end_page().PdfMetadata instance and call write(doc) to produce a PDF byte array from any RenderDocument.title, creator, producer, creation_date, and trapped fields on the output PDF.RenderDocument to a RasterSurface; encode with encode_png() or encode_bmp().RasterRenderer to render documents and compare pixel outputs in automated tests.FontResolver and build_embedded_font() for correct rendering.Paint objects with DeviceRGB or CIE-based color spaces to paths and text.Call PsDocument.from_file() to access the PostScript file and call to_pdf() to export it as a PDF byte stream.
from pathlib import Path
from aspose.page.ps.document import PsDocument
ps = PsDocument.from_file("input.ps")
output_pdf = ps.to_pdf()
Path("output.pdf").write_bytes(output_pdf)
The same PsDocument class handles EPS files. Pass an ImageSaveOptions with the desired format and DPI to to_image().
from aspose.page.ps.document import PsDocument
from aspose.page.ps.output import ImageSaveOptions
eps = PsDocument.from_file("input.eps")
output_png = eps.to_image(ImageSaveOptions(format="png", dpi=150))
with open("output.png", "wb") as f:
f.write(output_png)
Call XpsDocument.from_file() to access the XPS document and call to_pdf() to export it as a PDF byte stream.
from pathlib import Path
from aspose.page.xps.document import XpsDocument
xps = XpsDocument.from_file("input.xps")
output_pdf = xps.to_pdf()
Path("output.pdf").write_bytes(output_pdf)
Aspose.Page FOSS for Python is released under the MIT License, permitting use in commercial and proprietary applications.
No. The library has no dependency on Ghostscript, Adobe Reader, or any native runtime. It runs on Windows, Linux, and macOS.
The library reads PostScript (.ps), Encapsulated PostScript (.eps), and XPS (.xps) files.
The library exports to PDF via to_pdf() and to PNG or JPEG raster images via to_image() with ImageSaveOptions.
Yes. Use from_bytes() to load from raw bytes and the returned bytes from to_pdf() or to_image() directly without writing files.