We use aspose.pdf (Version 23.2.0, .Net 4.8) to insert watermark on each page in the upper right corner of the PDF document with the following code.
However, this does not work for all documents. The watermark appears outside the document (visible area) and is only with Adobe Acrobat Pro visible.
var watermark = $“Seite {from} von {to}”;
WatermarkArtifact artifact = new WatermarkArtifact();
artifact.SetTextAndState(
watermark,
new TextState()
{
FontSize = 12,
ForegroundColor = Color.Blue,
Font = FontRepository.FindFont(“Arial”)
});
artifact.ArtifactVerticalAlignment = VerticalAlignment.Top;
artifact.ArtifactHorizontalAlignment = HorizontalAlignment.Right;
artifact.RightMargin = 20;
artifact.Opacity = 1;
artifact.IsBackground = false;
20230312_watermark.PNG (12.1 KB)