HTML JPG PDF SVG PPT
  Product Family
XPS

Convert PDF to XPS in Python

Import PDF pages and save them as XPS with a cross-platform Python library

Convert PDF to XPS in Python

Aspose.Slides for Python via .NET lets you convert PDF documents to XPS programmatically. Import the source pages with SlideCollection.add_from_pdf, then call Presentation.save with SaveFormat.XPS.

Each PDF page becomes a slide in the presentation before the complete presentation is exported as one XPS document. You can also test the conversion in the online conversion app .

Install the library from PyPI by using the following pip command:

Console/Terminal

pip install aspose-slides

How to Convert PDF to XPS in Python

These are the steps to convert a PDF file to XPS using Python.

  1. Create a Presentation and remove its default blank slide.

  2. Import the source PDF by using SlideCollection.add_from_pdf.

  3. Call Presentation.save with the output file path and SaveFormat.XPS.

System Requirements

Before running the Python conversion example, make sure your environment meets these requirements.

  • Windows, macOS, or a supported 64-bit Linux distribution. See the system requirements .
  • Python 3.5 or later.
  • Aspose.Slides for Python via .NET installed in your environment.
 

This sample code shows PDF to XPS Python Conversion

with slides.Presentation() as presentation:
    presentation.slides.remove_at(0)
    presentation.slides.add_from_pdf("document.pdf")
    presentation.save("presentation.xps", slides.export.SaveFormat.XPS)
 

Save PDF as XPS in Python

Use the free online app to see the PDF-to-XPS conversion process in action.

Other Supported Conversions

You can also convert PDF documents to other supported formats.

PDF TO BMP (Bitmap Image)
PDF TO EMF (Enhanced Metafile Format)
PDF TO FODP (OpenDocument Flat XML Presentation)
PDF TO GIF (Graphics Interchange Format)
PDF TO HTML (Hypertext Markup Language)
PDF TO JPG (JPEG Image)
PDF TO ODP (OpenDocument Presentation)
PDF TO OTP (OpenDocument Presentation Template)
PDF TO PNG (Portable Network Graphics)
PDF TO POT (PowerPoint 97-2003 Template)
PDF TO POTM (Macro-Enabled PowerPoint Template)
PDF TO POTX (Open XML PowerPoint Template)
PDF TO PPS (PowerPoint 97-2003 Slide Show)
PDF TO PPSM (Macro-Enabled PowerPoint Slide Show)
PDF TO PPSX (Open XML PowerPoint Slide Show)
PDF TO PPT (PowerPoint 97-2003 Presentation)
PDF TO PPTM (Macro-Enabled PowerPoint Presentation)
PDF TO PPTX (Open XML PowerPoint Presentation)
PDF TO SVG (Scalable Vector Graphics)
PDF TO SWF (Shockwave Flash)
PDF TO TIFF (Tagged Image File Format)