XPS libraries for Python
- PyMuPDF wraps MuPDF.
pymupdf.open("file.xps")gives the sameDocumentAPI as for PDF: render pages to PNG, extract text with positions, convert to PDF in one call. AGPL-3.0 or commercial.
Without PyMuPDF you can still read an XPS file’s structure and text with zipfile and xml.etree: pages are .fpage parts and text is in the UnicodeString attribute of Glyphs elements.
- PyMuPDF PyMuPDF opens XPS and OpenXPS files in Python. How to install it, convert XPS to PDF, render XPS pages to PNG, extract text with positions.