WatermarkArtifact API not working on given PDF

Hi ,

For given attached PDF the watermark code is not working.
No error displayed but watermark is missing.

using (Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(fileStream))
                                        {
                                            WatermarkArtifact artifact = new WatermarkArtifact()
                                            {
                                                ArtifactVerticalAlignment = VerticalAlignment.Top,
                                                ArtifactHorizontalAlignment = HorizontalAlignment.Left,
                                                Opacity = 0.5,
                                                IsBackground = true,
                                                TopMargin = 7,
                                                LeftMargin = 7
                                            };

                                            artifact.SetLinesAndState(
                                                new string[] {
                                                    "ABC COPY",
                                                    $"  {docNumber}",
                                                    $"   {DateTime.Parse(OnDate).ToString("ddMMMyyyy")}"
                                                },
                                                new TextState()
                                                {
                                                    FontSize = 12,
                                                    ForegroundColor = Color.Red,
                                                    Font = FontRepository.FindFont("Courier")
                                                });

                                            pdfDocument.Pages[1].Artifacts.Add(artifact);
                                            pdfDocument.Save(pdfFilePath);

Could you please let us know why given PDF is not showing the watermark?
Is there any compatibility issue?

Note:- This given PDF was generated from .pptx file using aspose.

Thanks & Regards,
Poonam

TEST-1.pdf (5.7 KB)

@PoonamB,

Can you try the following code, please?

private void Logic()
{
    var doc = new Document($"{PartialPath}_input.pdf");

    int docNumber = 123456;

    WatermarkArtifact artifact = new WatermarkArtifact();
    artifact.SetLinesAndState(
        new string[] {
                                            "ABC COPY",
                                            $"  {docNumber}",
                                            $"   {DateTime.Today.ToString("ddMMMyyyy")}"
        },
        new TextState()
        {
            FontSize = 28,
            ForegroundColor = Color.Red,
            BackgroundColor = Color.Red,
            Font = FontRepository.FindFont("Arial")
        });

    artifact.ArtifactVerticalAlignment = VerticalAlignment.Top;
    artifact.ArtifactHorizontalAlignment = HorizontalAlignment.Left;
    
    artifact.Rotation = 315;
    artifact.Opacity = 0.5;
    
    artifact.TopMargin = 7;
    artifact.LeftMargin = 7;

    artifact.IsBackground = false;            


    doc.Pages[1].Artifacts.Add(artifact);

    doc.Save($"{PartialPath}_output.pdf");
}

Keep in mind if a piece of the watermark is out of the bound it wont be drawn.

AddingWatermarkArtifact_output.pdf (83.2 KB)