Add Footer to PDF via C#

Add Footer to PDF File using .NET Library.

Add Footers to PDF Document Using C# Library

In order to add footers into PDF file, we’ll use Aspose.PDF for .NET API which is a feature-rich, powerful and easy to use document manipulation API for net 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

Steps to add Footer to PDF via C#


You need Aspose.PDF for .NET 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


    Document pdfDocument = new Document(dataDir+ "ImageInFooter.pdf");
    ImageStamp imageStamp = new ImageStamp(dataDir+ "aspose-logo.jpg");
    imageStamp.BottomMargin = 10;
    imageStamp.HorizontalAlignment = HorizontalAlignment.Center;
    imageStamp.VerticalAlignment = VerticalAlignment.Bottom;
    foreach (Page page in pdfDocument.Pages)
    {
        page.AddStamp(imageStamp);
    }
    dataDir = dataDir + "ImageInFooter_out.pdf";
    pdfDocument.Save(dataDir);