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

Free Support Forum - aspose.com

WatermarkAnnotation on digitally signed pdf documents

Hello,

I have 2 pdf documents on which i need to add WatermarkAnnotation with Aspose.Pdf. Both documents are digitally signed by our customer on their own way.
There is one of two documents where the digitally signature is broken after adding a WatermarkAnnotation on it, with sample code below.
Here’s the documents (Input1 broken after adding watermark, Input2 OK).
Input1.pdf (101.9 KB)
Input2.pdf (224.3 KB)

static bool AddWatermark(string filename)
		{
			
			try
			{
				using (FileStream fs = new FileStream("D:\\Docs\\aspose\\Sign\\" + filename, FileMode.Open, FileAccess.ReadWrite))
				{

					Document pdfDoc = new Document(fs);
					Page page = pdfDoc.Pages[1];
					WatermarkAnnotation wa = new WatermarkAnnotation(page, new Aspose.Pdf.Rectangle(100, 500, 400, 600));
					
					page.Annotations.Add(wa);
					TextState ts = new Aspose.Pdf.Text.TextState();
					ts.Font = FontRepository.FindFont("Times New Roman");

					ts.FontSize = 32;
					wa.SetTextAndState(new string[] { "Date de signature" }, ts);


					pdfDoc.Save();
					return true;
				}

			}
			catch (Exception ex)
			{
				return false;
			}
		}

@Oxyad

We were able to reproduce this behavior in our environment. It looks like that signatures are not completely validated in the Input2.pdf and they are waiting for confirmation for the changes that are made into it after it was signed. The revoking of signatures in an existing PDF after doing changes into it is an expected behavior. Nevertheless, we will try to investigate it further and let you know as soon as the ticket PDFNET-52622 is resolved. Please be patient and spare us some time.