We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Insert watermark

Dear Team,

We need solution for insert watermark in PDF Across all page with 90 degree vertical with 1.3 inch left indent.

WaterMark Word : AUTHOR MANUSCRIPT

Input & Expected OP : Watermark.zip (353.5 KB)

Thank you

@ssvel

Thanks for contacting support.

Please use following code snippet in order to meet your requirements:

Document pdfDocument = new Document(dataDir + "InputWM.pdf");
string str = "Author Manuscript";
TextStamp textStamp = new TextStamp(str);
//set text properties
//textStamp.TextState.Font = FontRepository.FindFont("Arial");
string strSize = "66";
textStamp.TextState.FontSize = Convert.ToSingle(strSize);
textStamp.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Gray);
textStamp.Opacity = 0.5;
textStamp.VerticalAlignment = VerticalAlignment.Center;
textStamp.XIndent = 72 * 1.3; // 1 inch = 72 Points
textStamp.RotateAngle = 90;
         
pdfDocument.Pages[1].AddStamp(textStamp);
pdfDocument.Save(dataDir + "Watermark.pdf"); 

Watermark.pdf (130.5 KB)

In case of any further assistance, please feel free to let us know.

@asad.ali

Thanks for your valuable response. But this code how to handled in java.

@ssvel

Please use following code snippet for Java platforms:

Document pdfDocument = new Document(dataDir + "InputWM.pdf");
String str = "Author Manuscript";
TextStamp textStamp = new TextStamp(str);
// Set text properties
//textStamp.TextState.Font = FontRepository.FindFont("Arial");
textStamp.getTextState().setFontSize(66);
textStamp.getTextState().setForegroundColor(com.aspose.pdf.Color.getGray());
textStamp.setOpacity(0.5);
textStamp.setVerticalAlignment(VerticalAlignment.Center);
textStamp.setXIndent(72 * 1.3); // 1 inch = 72 Points
textStamp.setRotateAngle(90);

pdfDocument.getPages().get_Item(1).addStamp(textStamp);
pdfDocument.save(dataDir + "Watermark.pdf");