Bates Numbering or stamping Aspose.pdf for .Net

Hi,

Is Bates Numbering or stamping supported by Aspose.pdf for .Net?
If it is, can you please provide code on how to add bates numbers to pdf files?

Thank you

@AdamPru,

There is stamping in Aspose.Pdf API. This can be achieved in many ways. But for your purpose I think this code sample will be good:

private void Logic()
{
    // Create PdfFileStamp object
    PdfFileStamp fileStamp = new PdfFileStamp();

    // Open Document
    fileStamp.BindPdf($"{PartialPath}_input.pdf");

    // Get total number of pages
    int totalPages = new PdfFileInfo($"{PartialPath}_input.pdf").NumberOfPages;

    bool embbeded = false;

    // Create formatted text for page number
    FormattedText formattedText = new FormattedText($"Page # of {totalPages}",
        System.Drawing.Color.AntiqueWhite,
        System.Drawing.Color.Gray,
        FontStyle.TimesBoldItalic,
        EncodingType.Winansi,
        embbeded,
        12);

    // Set starting number for first page; you might want to start from 2 or more
    fileStamp.StartingNumber = 1;

    // Add page number
    fileStamp.AddPageNumber(formattedText, (int)PageNumPosition.PosBottomMiddle);

    // Save updated PDF file
    fileStamp.Save($"{PartialPath}_output.pdf");

    // Close fileStamp
    fileStamp.Close();
}

public enum PageNumPosition
{ 
    PosBottomMiddle = 0,
    PosBottomRight = 1,
    PosUpperRight = 2,
    PosSidesRight = 3,
    PosUpperMiddle = 4,
    PosBottomLeft = 5,
    PosSidesLeft = 6,
    PosUpperLeft = 7,
}

The colors are not the best, but I did them so you know it can be done with the background.