Edit PDF in C++

Use Aspose.Slides for C++ to edit PDF files in C++ applications.

Edit PDF in C++

Using Aspose.Slides for C++ , 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

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();

Edit PDF using Aspose.Slides

Aspose.Slides for C++ 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.

How to edit PDF in C++

  1. Install Aspose.Slides for C++. See Installation.
  2. Add the library as a reference in your project.
  3. Create a Presentation instance.
  4. Import the PDF file with AddFromPdf.
  5. Add a text shape with AddAutoShape and set_Text.
  6. Save the edited file with SaveFormat::Pdf.

Built with Aspose.Slides

Edit PPTX Files Online

The free Aspose.Slides Editor app is built with Aspose.Slides for C++, the same API as the code above. Open it and see what the API can do with your own PPTX files.

  • Runs in your browser, nothing to install.
  • See how Aspose.Slides handles your files before you write code.
  • Upload your PPTX files and edit them instantly.
  • Save and download the edited file.

Edit other files

You can also edit files in other formats.