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

Free Support Forum - aspose.com

Extract Stamp from PDF in C#

Hi,

I want to see all stamps on a document and which StampID they have, but the GetStamps() method does always return an empty list.

	    [TestMethod]
		public void LogAllStampIDsTest()
		{
			StringBuilder sb = new StringBuilder();
			var pdfContentEditor = new PdfContentEditor();

			pdfContentEditor.BindPdf(@"C:\StampedDocument.pdf");

			sb.AppendLine($"Page\tStampText\tStampID");

			for (int i = 1; i <= pdfContentEditor.Document.Pages.Count; i++)
			{
				foreach (var stamp in pdfContentEditor.GetStamps(i))
				{
					sb.AppendLine($"{i}\t{stamp.Text}\t{stamp.StampId}");
				}
			}

			File.WriteAllText(@"C:\Stamps.txt", sb.ToString());

		}

We use Apose.PDF (for .NET) version 22.1.0.

Am I doing something wrong here?StampedDocument.pdf (54.6 KB)

@digiofficerobin

We were able to replicate the issue in our environment while testing the scenario with Aspose.PDF for .NET 22.1. Therefore, it has been logged as PDFNET-51359 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.