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 pathPsDocument.from_bytes(data)— load from raw bytesPsDocument.to_pdf(options)— export to PDF bytesPsDocument.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 pathXpsDocument.from_bytes(data)— load from raw bytesXpsDocument.to_pdf(options)— export to PDF bytesXpsDocument.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
| Class | Description |
|---|---|
PsDocument | Load and export PS/EPS files |
XpsDocument | Load and export XPS files |
ImageSaveOptions | Controls raster output format and DPI |
DscMetadata | EPS DSC header fields (bounding box, title, etc.) |
PdfWriter | Serialize a RenderDocument to PDF bytes |
PdfMetadata | PDF output metadata (title, creator, producer) |
RenderModelBuilder | Build render documents incrementally |
McpInput | MCP server input (file path or base64 bytes) |
McpOutput | MCP server output (base64 bytes or file path) |