PsDocument
Overview
PsDocument is a class in Aspose.Page FOSS for Python.
Represents a loaded or editable PS/EPS document.
This class provides 14 methods for working with PsDocument objects in Python programs.
Available methods include: add_page, as_bytes, create, from_bytes, from_file, get_page, get_xmp, insert_page, remove_page, remove_xmp, save, set_xmp, and 2 additional methods.
All public members are accessible to any Python application after installing the Aspose.Page FOSS for Python package.
Properties: data, dirty, dsc, header, is_eps, pages, and 3 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
data | bytes | Read | Gets the data. |
is_eps | bool | Read | Gets the is eps. |
dsc | DscMetadata | None | Read | Gets the dsc. |
source_path | str | None | Read | Gets the source path. |
pages | list[PsPage] | Read | Gets the pages. |
prolog | list[str] | Read | Gets the prolog. |
trailer | list[str] | Read | Gets the trailer. |
header | str | None | Read | Gets the header. |
dirty | bool | Read | Gets the dirty. |
Methods
| Signature | Description |
|---|---|
create(is_eps: bool, page_size: tuple[float, float]) → "PsDocument" | Create a new PS/EPS document with a single empty page. |
from_bytes(data: bytes) → "PsDocument" | Create a document from bytes and detect EPS metadata. |
from_file(path: str) → "PsDocument" | Create a document from a file path. |
add_page(size: tuple[float, float] | None) → PsPage | Append a new page and return it. |
insert_page(index: int, size: tuple[float, float] | None) → PsPage | Insert a new page at the provided index and return it. |
remove_page(index: int) | Remove the page at the provided index. |
get_page(index: int) → PsPage | Return the page at the provided index. |
save(path: str | None) → bytes | Serialize the document to bytes and optionally write to a file. |
as_bytes() → bytes | Return the raw document bytes. |
get_xmp() → str | None | Return XMP metadata from an EPS document, if present. |
set_xmp(xmp_xml: str) | Set XMP metadata on an EPS document. |
remove_xmp() | Remove XMP metadata from an EPS document. |
to_pdf(options: "PdfSaveOptions | None") → bytes | Export the document to PDF bytes. |
to_image(options: "ImageSaveOptions") → bytes | Export the document to raster image bytes. |