Hi,
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);
aPFS.AddFooter(aFT,20);
//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.BindLogo(formatText);
//logoStamp.Rotation = 50;
logoStamp.IsBackground = true;
logoStamp.SetOrigin(200, 400);
aPFS.AddStamp(logoStamp);
aPFS.Close();
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);
//
//aPFS2.AddPageNumber(formatPageText,5,200,0,0,400);
aPFS2.Close();
aFS.Close();
aMS1.Flush();
aMS1.Close();