# Convert PDF to XML in Python

> Convert PDF to XML in Python. Use the Aspose.Slides Python API to import PDF pages and save them as a PowerPoint XML Presentation.

Source: https://products.aspose.com/slides/python-net/conversion/pdf-to-xml/
Updated: 2026-07-23



## Convert PDF to XML in Python

[*Aspose.Slides for Python via .NET*](/slides/python-net/) lets you import PDF pages into a presentation and save the result as a PowerPoint XML Presentation. Use `SlideCollection.add_from_pdf` to create slides from the PDF pages, then call `Presentation.save` with `SaveFormat.XML`.

The output is a single XML presentation file that contains the imported pages as slides. This workflow does not require Microsoft PowerPoint, Adobe Acrobat, or another presentation application.

## Convert PDF to XML using Python

Create a `Presentation`, remove its default blank slide, import the PDF pages, and save the presentation in the PowerPoint XML Presentation format.

### Python code for converting PDF into XML

```python
with slides.Presentation() as presentation:
    presentation.slides.remove_at(0)
    presentation.slides.add_from_pdf("document.pdf")
    presentation.save("document.xml", slides.export.SaveFormat.XML)
```

## How to Convert PDF to XML Using the Aspose.Slides Python API

These are the steps to convert PDF to XML in Python.

Install [*Aspose.Slides for Python via .NET*](/slides/python-net/).

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

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

Call `Presentation.save` with the output file path and `SaveFormat.XML`.

## Convert PDF to Other Supported Formats

- [PDF TO HTML](/slides/python-net/conversion/pdf-to-html/)
- [PDF TO IMAGE](/slides/python-net/conversion/pdf-to-image/)
- [PDF TO JPG](/slides/python-net/conversion/pdf-to-jpg/)
- [PDF TO PNG](/slides/python-net/conversion/pdf-to-png/)
- [PDF TO TIFF](/slides/python-net/conversion/pdf-to-tiff/)
- [PDF TO SVG](/slides/python-net/conversion/pdf-to-svg/)
- [PDF TO PPTX](/slides/python-net/conversion/pdf-to-pptx/)
- [PDF TO PPT](/slides/python-net/conversion/pdf-to-ppt/)
