# Edit PDF in Python

> Import PDF pages, add text or shapes, and export the edited result as PDF with Aspose.Slides for Python via .NET.

Source: https://products.aspose.com/slides/python-net/editor/pdf/
Updated: 2026-07-27



## Edit PDF using Aspose.Slides

[*Aspose.Slides for Python via .NET*](/slides/python-net/) lets you import PDF pages as slides, add presentation elements such as text and shapes, and export the edited presentation as a new PDF document. This workflow overlays new slide content rather than modifying the original PDF objects.

## Edit PDF in Python

The following example imports a PDF file into a `Presentation`, adds a text-bearing shape to the first imported slide, and exports the result as a new PDF document.

### Python code for editing PDF

```python
with slides.Presentation() as presentation:
    presentation.slides.remove_at(0)
    presentation.slides.add_from_pdf("document.pdf")

    slide = presentation.slides[0]
    text_shape = slide.shapes.add_auto_shape(
        slides.ShapeType.RECTANGLE, 10, 10, 300, 50)
    text_shape.text_frame.text = "New text"

    presentation.save("edited-document.pdf", slides.export.SaveFormat.PDF)
```

## How to edit PDF in Python

Install Aspose.Slides for Python via .NET by following the [installation guide](https://docs.aspose.com/slides/python-net/installation/).

Create an empty `Presentation`.

Remove the default blank slide from the presentation.

Pass the source PDF file to `SlideCollection.add_from_pdf`.

Access the imported slide through a `slide` variable, add an `AutoShape`, and set its text.

Call `Presentation.save` with `SaveFormat.PDF` to create the edited PDF document.

## Edit other files
