Add Page Number Stamp on all PDF pages using Aspose.PDF REST API

Hi,

I’m trying to use Add Page Number Stamp to a PDF Page.
It only stamp the page that I put it on url. Is there a way to put the stamp on all pages?

Please help

Thanks

@bsohmers

Thank you for contacting Aspose Support.

I am afraid, at present, there is no API that let you add Stamp on all pages of a PDF document in a single API call. We have logged this feature request PDFCLOUD-389 in our internal tracking software and we are working to provide the requested API.

Meanwhile, you can call GET /pdf/{name}/pages API to get pages information of a PDF document then call
PUT /pdf/{name}/pages/{pageNumber}/stamp for each page of a PDF document to add a stamp on it.

Hi Sohail,

Thanks for the response.

So is this stamp action as a billable operation?

@bsohmers

Yes, PUT /pdf/{name}/pages/{pageNumber}/stamp is a billable operation. Please check this page for Pricing details.

@bsohmers

Please note, in the latest version of Aspose.PDF Cloud you can use PostDocumentPageNumberStamps API method to add a page number stamp on all the pages of a PDF document. Please check the following sample code for reference.

POST ​/pdf​/{name}​/stamps​/pagenumber Add document page number stamps

const string Name = "4pages.pdf";

PageNumberStamp stamp = new PageNumberStamp()
{
    Background = true,
    LeftMargin = 1,
    RightMargin = 2,
    TopMargin = 3,
    BottomMargin = 4,
    HorizontalAlignment = HorizontalAlignment.Center,
    VerticalAlignment = VerticalAlignment.Center,
    Opacity = 1,
    Rotate = Rotation.None,
    RotateAngle = 0,
    XIndent = 0,
    YIndent = 0,
    Zoom = 1,
    StartingNumber = 1,
    Value= "Page # of 4"

};
var response = pdfApi.PostDocumentPageNumberStamps(Name, stamp, startPageNumber: 1, endPageNumber: 4);