Exception when adding WatermarkArtifact

Hi,
I am trying to add a watermark to a page and getting an exception. When I even try to use the sample code (See below) from the aspose examples I get an error exception

         Aspose.Pdf.Document document = new Aspose.Pdf.Document("C:\\Temp\\letter.pdf");
                Aspose.Pdf.WatermarkArtifact artifact = new Aspose.Pdf.WatermarkArtifact();
                artifact.SetTextAndState(
                    "LETTER NOT APPROVED",
                    new Aspose.Pdf.Text.TextState()
                    {
                        FontSize = 14,
                        ForegroundColor = Aspose.Pdf.Color.Red
                    });
                artifact.ArtifactHorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Center;
                artifact.ArtifactVerticalAlignment = Aspose.Pdf.VerticalAlignment.Center;
                artifact.Rotation = 45;
                artifact.Opacity = 0.5;
                artifact.IsBackground = true;
                document.Pages[1].Artifacts.Add(artifact);
                document.Save("c:\\temp\\watermark.pdf");

The exception is ‘System.NullReferenceException’
The artifact object properties Content and Rectangle show exceptions for Null Reference
The stack trace is
" at Aspose.Pdf.Artifact.#=z7SlCjBA=()\r\n at Aspose.Pdf.Artifact.#=zHa90LwE=()\r\n at Aspose.Pdf.Artifact.#=zEybCm1g=()\r\n at Aspose.Pdf.Artifact.#=zESWcYFjWAsiE(OperatorCollection #=zvWzJkiY=)\r\n at Aspose.Pdf.ArtifactCollection.Add(Artifact artifact)\r\n at …my stuff

Any insight or suggestions appreciated

@markchequer

Are you facing this issue with specific PDF document or with any PDF that you are processing? Can you please share your sample source file with us as well? Also, please try using TextStamp Class in order to add watermark in the PDF and see if it meets your requirements:

Thank you for responding, any PDF has the problem, but here is one that failed. Letter.pdf.pdf (84.7 KB).

Also, I tested TextStamp and it works perfectly for my purpose. So I am good with this, but as a heads up, there is something wrong with that Watermark example, it just does not work.

@markchequer

It is good to know that the suggested approach is working for you. For further investigation against watermark functionality, a task as PDFNET-52932 has been logged in our issue tracking system as well. We will 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.

The issues you have found earlier (filed as PDFNET-52932) have been fixed in Aspose.PDF for .NET 23.5.