Features

Features

Aspose.Page FOSS for Python provides the following capabilities.


PS and EPS Conversion

PsDocument loads PostScript (.ps) and Encapsulated PostScript (.eps) files and exports them to PDF or raster images. Both file types are handled by the same class.

  • PsDocument.from_file(path) — load from file path
  • PsDocument.from_bytes(data) — load from raw bytes
  • PsDocument.to_pdf(options) — export to PDF bytes
  • PsDocument.to_image(options) — export to PNG or JPEG bytes

XPS Conversion

XpsDocument loads XML Paper Specification (.xps) files and exports them to PDF or raster images. The same to_pdf() and to_image() interface applies.

  • XpsDocument.from_file(path) — load from file path
  • XpsDocument.from_bytes(data) — load from raw bytes
  • XpsDocument.to_pdf(options) — export to PDF bytes
  • XpsDocument.to_image(options) — export to raster image bytes

Raster Image Output

ImageSaveOptions controls the raster output format and resolution. Set format to "png" or "jpeg" and dpi to specify the output resolution.


EPS Metadata

DscMetadata provides structured access to DSC header comments in EPS files: bounding box, page size, orientation, title, and creator fields. Access via PsDocument.dsc.


MCP Server

An optional MCP server exposes ps_to_pdf, ps_to_image, xps_to_pdf, and xps_to_image as remote conversion tools via FastMCP. McpInput and McpOutput handle file paths and base64-encoded bytes.


Low-Level Rendering

RenderModelBuilder constructs RenderDocument objects incrementally with begin_page(), add_path(), add_text(), add_image(), and end_page(). PdfWriter serializes a RenderDocument to PDF. PdfMetadata sets document metadata.


API Reference Summary

ClassDescription
PsDocumentLoad and export PS/EPS files
XpsDocumentLoad and export XPS files
ImageSaveOptionsControls raster output format and DPI
DscMetadataEPS DSC header fields (bounding box, title, etc.)
PdfWriterSerialize a RenderDocument to PDF bytes
PdfMetadataPDF output metadata (title, creator, producer)
RenderModelBuilderBuild render documents incrementally
McpInputMCP server input (file path or base64 bytes)
McpOutputMCP server output (base64 bytes or file path)

See Also