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

Free Support Forum - aspose.com

Displaying water mark as transperant


I want to display the water mark behind the text or image in the pdf file.

I used the stamp IsBackground = True property. Then it is coming behind if the pdf document contains the text.

But in my case, we are scanning the original document from the paper and creating the pdf document. so the original document contains the content as image. it contains the text content as image. so the watermark is displayed behind the image. it is not visible in the document. but if we select the content in the document, we are able to see the area allocated for the water mark. but not able to see the actual text in the watermark. only area is visible if we select the content.

currently i am using the following code

FileStream aFS = new FileStream(@"C:\CSharp.pdf", FileMode.Open, FileAccess.Read);

Int32 aLength = (Int32)aFS.Length;

FileStream aOS = new FileStream(@"C:\CSharpcopy.pdf", FileMode.OpenOrCreate, FileAccess.ReadWrite);

MemoryStream aMS1 = new MemoryStream(aLength );

PdfFileStamp aPFS = new PdfFileStamp(aFS, aMS1);

FormattedText aFT = new FormattedText(DateTime.Now.ToString(),System.Drawing.Color.FromArgb(0, 0, 225), FontStyle.TimesItalic, EncodingType.Winansi, true, 12);


//Instantiate a stamp object

Stamp logoStamp = new Stamp();

//Instantiate an object of FormattedText class

FormattedText formatText = new FormattedText("User Name", System.Drawing.Color.FromArgb(210, 210, 210), FontStyle.TimesItalic, EncodingType.Winansi, true, 50);

//BindLogo to PDF


//logoStamp.Rotation = 50;

logoStamp.IsBackground = true;

logoStamp.SetOrigin(200, 400);



PdfFileInfo fileInfo = new PdfFileInfo(@"C:\CSharp.pdf");

aMS1.Position = 0;

PdfFileStamp aPFS2 = new PdfFileStamp(aMS1, aOS);

FormattedText formatPageText = new FormattedText("#" + "/" + fileInfo.NumberofPages, System.Drawing.Color.FromArgb(192, 192, 192), FontStyle.TimesItalic, EncodingType.Winansi, false, 12);








Thank you for your quick response. The solution you gave i already know. the problem is if i set IsBackground = false then the watermark is coming over the text. so that we are not able to read the text properly since watermark is hiding some text. so we need to display watermark behind the image text. so that the text will be more readable. This is our requirement. Watermark should be transperant over the image. Kindly let me know whether it is possible to set the watermark as transperant behind the image.

Thank you


Srirangam K