Add Rubber Stamp in C++

Use PdfContentEditor for this task. The examples below retain the original C++ code and API Reference steps.

Add rubber stamp

Create a green Approved rubber-stamp annotation on page 1.

  1. Create PdfContentEditor.
  2. Bind the PDF input with Facade::BindPdf().
  3. Create the rubber-stamp annotation with PdfContentEditor::CreateRubberStamp().
  4. Save the resulting PDF with PdfContentEditor::Save().
#include <Aspose.PDF.Cpp/Color.h>
#include <Aspose.PDF.Cpp/Facades/PdfContentEditor.h>
#include <drawing/color.h>
#include <drawing/rectangle.h>
#include <system/string.h>

namespace Facades::Examples::PDF_ContentEditor
{
using namespace System;
using namespace Aspose::Pdf;
using namespace Aspose::Pdf::Facades;
using Rectangle = System::Drawing::Rectangle;
using DrawingColor = System::Drawing::Color;

void AddRubberStamp(String inputFile, String outputFile)
{
    auto editor = MakeObject<PdfContentEditor>();

    editor->BindPdf(inputFile);
    editor->CreateRubberStamp(1, Rectangle(120, 450, 180, 60), u"Approved", u"Approved by reviewer",
                              DrawingColor::get_Green());
    editor->Save(outputFile);
}
} // namespace Facades::Examples::PDF_ContentEditor