I need to add an image stamp on an existing pdf, and this image needs to pass accessibility requirements.
If I understand correctly I need to use an artifact to achieve this. There was a similar question on the forum before- https://forum.aspose.com/t/marking-textstamp-as-artifact/200629, in which you suggested using an WatermarkArtifact.
However the WatermarkArtifact code throws a null exception, (WatermarkArtifact’s content and Rectangle properties also throw a null exception, not sure if that’s relevant)
I simply cannot find any example online to make this work- an image stamp/watermark/whatever that passes PDF/UA.
Here is my code. the last line throws the exception.
Document pdfDocument = new Document(filePath); Artifact watermark = new WatermarkArtifact(); FileStream file = new FileStream(imagePath , FileMode.Open); watermark.SetImage(file); watermark.Position = new Aspose.Pdf.Point(x, y); watermark.Text = "Accessible"; watermark.IsBackground = true; watermark.ArtifactHorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center; watermark.ArtifactVerticalAlignment = Aspose.Pdf.VerticalAlignment.Center; pdfDocument.Pages.Artifacts.Add(watermark); - this throws a null exception
Any idea? Thank you!