XpsDocument
Overview
XpsDocument is a class in Aspose.Page FOSS for Python.
Represents a loaded or editable XPS document.
This class provides 12 methods for working with XpsDocument objects in Python programs.
Available methods include: add_page, create, from_bytes, from_file, get_print_tickets, insert_page, remove_page, remove_print_ticket, save, set_print_ticket, to_image, to_pdf.
All public members are accessible to any Python application after installing the Aspose.Page FOSS for Python package.
Properties: builder, package.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
package | XpsPackage | Read | Gets the package. |
builder | XpsDocumentBuilder | Read | Gets the builder. |
Methods
| Signature | Description |
|---|---|
create(title: str | None) → "XpsDocument" | Create a new empty XPS document. |
from_bytes(data: bytes) → "XpsDocument" | Create an XPS document from bytes. |
from_file(path: str) → "XpsDocument" | Create an XPS document from a file path. |
add_page(width: float, height: float) → XpsFixedPage | Append a new fixed page and return it. |
insert_page(index: int, page: XpsFixedPage) | Insert a fixed page at the given index. |
remove_page(index: int) | Remove a fixed page at the given index. |
save(path: str | None) → bytes | Serialize the document to bytes and optionally write to a file. |
get_print_tickets() → list["PrintTicket"] | Return all print tickets in the document. |
set_print_ticket(scope: str, xml: str, page_index: int | None) | Add or replace a print ticket at the requested scope. |
remove_print_ticket(scope: str, page_index: int | None) | Remove a print ticket at the requested scope. |
to_pdf(options: "PdfSaveOptions | None") → bytes | Export the document to PDF bytes. |
to_image(options: "ImageSaveOptions") → bytes | Export the document to raster image bytes. |