@aqpeeb
You can use PostDocumentTextHeader API method to add text to all pages of the PDF document. Please check the sample Node.js code for reference.
async function test(){
const { PdfApi } = require("asposepdfcloud");
const { TextHeader }= require("asposepdfcloud/src/models/textHeader");
const { TextState }= require("asposepdfcloud/src/models/textState");
const { HorizontalAlignment }= require("asposepdfcloud/src/models/horizontalAlignment");
const { Color }= require("asposepdfcloud/src/models/Color");
const { Rotation }= require("asposepdfcloud/src/models/rotation");
const { FontStyles }= require("asposepdfcloud/src/models/fontStyles");
// Get App Key and App SID from https://dashboard.aspose.cloud/
pdfApi = new PdfApi("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx", "xxxxxxxxxxxxxxxxxx");
const color = new Color();
color.a = 1;
color.r = 0;
color.g = 0;
color.b = 0;
const textState = new TextState();
textState.fontSize = 36;
textState.font = "Arial";
textState.foregroundColor = color;
textState.fontStyle = FontStyles.Regular;
const textHeader = new TextHeader();
textHeader.background = true;
textHeader.horizontalAlignment = HorizontalAlignment.Center;
textHeader.textAlignment = HorizontalAlignment.Center;
textHeader.topMargin = 250;
textHeader.opacity = 0.5,
textHeader.zoom = 1;
textHeader.rotate = Rotation.on90;
textHeader.rotateAngle = 45;
textHeader.value = "test aspose cloud";
textHeader.textState = textState;
const processWatermark = new Promise((resolve, reject) => {
let name = "4pages.pdf";
pdfApi.postDocumentTextHeader(name, textHeader, null, null, null, null)
.then((result) => resolve(true))
.catch((err) => resolve(true));
})
console.log(await processWatermark);
}
test();
I am afraid you can not add a multiline text stamp. However, you can add text twice to different positions.