# Edit PDF in C++

> Edit PDF files in C++. Use Aspose.Slides for C++ to import a PDF, add text, and save the edited PDF file.

Source: https://products.aspose.com/slides/cpp/editor/pdf/
Updated: 2026-07-09



## Edit PDF using Aspose.Slides

[**Aspose.Slides for C++**](/slides/cpp/) is a C++ API for working with presentation content and related formats. You can import a `PDF` file into a `Presentation`, add text to a slide, and save the result as `PDF`.

## Edit PDF in C++

Using [**Aspose.Slides for C++**](/slides/cpp/), you can edit a `PDF` file by importing it with `AddFromPdf`, adding a text shape, and saving the result with `SaveFormat::Pdf`.

### C++ code for editing PDF

```cpp
auto presentation = MakeObject<Presentation>();

presentation->get_Slides()->RemoveAt(0);
presentation->get_Slides()->AddFromPdf(u"document.pdf");

auto slide = presentation->get_Slide(0);
auto textBox = slide->get_Shapes()->AddAutoShape(ShapeType::Rectangle, 10, 10, 100, 50);
textBox->get_TextFrame()->set_Text(u"New text");

presentation->Save(u"document.pdf", SaveFormat::Pdf);
presentation->Dispose();
```

## How to edit PDF in C++

Install **Aspose.Slides for C++**. See [**Installation**](https://docs.aspose.com/slides/cpp/installation/).

Add the library as a reference in your project.

Create a `Presentation` instance.

Import the `PDF` file with `AddFromPdf`.

Add a text shape with `AddAutoShape` and `set_Text`.

Save the edited file with `SaveFormat::Pdf`.

## Edit other files
