Add Footer to PDF via Python

Add Footer to PDF File using Python for .NET.

Add Footers to PDF Document Using Python

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 python-net platform. Open NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.

Python Package Manager Console

pip install aspose-pdf

Steps to add Footer to PDF via Python


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

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

    pdfDocument = Document(dataDir+ "ImageInFooter.pdf")
    imageStamp = ImageStamp(dataDir+ "aspose-logo.jpg")
    imageStamp.BottomMargin = 10
    imageStamp.HorizontalAlignment = HorizontalAlignment.Center
    imageStamp.VerticalAlignment = VerticalAlignment.Bottom
    for page in pdfDocument.Pages:
        page.AddStamp(imageStamp)

    dataDir = dataDir + "ImageInFooter_out.pdf"
    pdfDocument.Save(dataDir)