Convert PDF to XML in Python

Import PDF pages and save them in the PowerPoint XML Presentation format with a cross-platform Python API

Convert PDF to XML in Python

Aspose.Slides for Python via .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

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.

  1. Install Aspose.Slides for Python via .NET .

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

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

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

Convert PDF to Other Supported Formats

You can also convert PDF documents to other supported formats.