Remove Images from PDF document via C++

Delete images from PDF document using Aspose.PDF for C++ Library

Remove Images from PDF Document Using C++ Library

In order to remove Image from PDF, we’ll use Aspose.PDF for C++ API which is a feature-rich, powerful and easy to use document manipulation API for cpp platform. Open NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.

Package Manager Console

PM > Install-Package Aspose.PDF.Cpp

Delete Images from PDF via C++


You need Aspose.PDF for C++ to try the code in your environment.

  1. Open existing PDF Document.
  2. Delete a particular image.
  3. Save updated PDF file.

Delete Images from Existing PDF File - C++

This sample code shows how to remove Images from PDF - C++


    // Open document
    auto document = MakeObject<Document>(_dataDir + u"DeleteImages.pdf");

    // Delete a particular image
    document->get_Pages()->idx_get(1)->get_Resources()->get_Images()->Delete(1);

    // Save updated PDF file
    document->Save(_dataDir + u"DeleteImages_out.pdf");

About Aspose.PDF for C++ API

A PDF Processing Library to create cross-platform applications with the ability to generate, modify, convert, render, secure and print documents without using Adobe Acrobat. It supports converting various file formats into PDF including HTML and converting PDF documents into various output formats. Developers can easily render all HTML content in a single Page PDF as well as convert HTML files with SVG graphic tags to Tagged PDF files. .NET PDF API offers compression, table creation, graph & image functions, hyperlinks, stamp and watermarking tasks, extended security controls & custom font handling.