Add Footer to PDF via C++

Add Footer to PDF File using C++ Library.

Add Footers to PDF Document Using C++ Library

In order to add footers into PDF file, 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

Steps to add Footer to PDF via C++


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

  1. Open a PDF document using Document object.
  2. Create a Stamp and define its properties.
  3. Add the Stamp to Page using AddStamp method.
  4. Save the PDF file.

Add Image in Footer of PDF File - C++

This sample code shows how to add image in footer of PDF


    auto document = MakeObject<Document>(_dataDir + inputFileName);
    auto imageStamp = MakeObject<ImageStamp>(_dataDir + u"aspose-logo.jpg");
    imageStamp->set_TopMargin(10);
    imageStamp->set_HorizontalAlignment(HorizontalAlignment::Center);
    imageStamp->set_VerticalAlignment(VerticalAlignment::Top);
    for (auto page : document->get_Pages())
    {
        page->AddStamp(imageStamp);
    }
    document->Save(_dataDir + outputFileName);