Free Support Forum - aspose.com

Extra Watermark in PDF/Graphic

Hello,

we have a problem with a PDF-Document and set a Watermark with the addstamp-method.
On the third page are two graphics. When setting the watermark, the watermark is used once for the complete document (ok) and additionally once again behind the bar chart (not ok).

Aspose-PDF .Net-Version: 18.2

Why is the watermark added after the graphic?

Thanks for the help.
Manuel Memenga

Test.pdf (90.2 KB)
WatermarkTest.pdf (88.7 KB)

@manuel.memenga

Thanks for contacting support.

Would you please share the sample code snippet along with sample image (for watermark), which you are using at your side. We will test the scenario in our environment and address it accordingly.

Thanks for your reply.

Watermark: WatermarkTest.pdf

Code:
        Dim license = New License()
            license.SetLicense("Aspose.Total.lic")
            license.Embedded = True

        Dim pdfDocument = New Document("C:\Test.pdf")
        Dim stamp = New PdfPageStamp("C:\watermarkTest.pdf", 1)

        For Each page As Page In pdfDocument.Pages
          page.AddStamp(stamp)
        Next
        
        pdfDocument.Save("C:\Result.pdf")

2018-08-01_17h44_16.png (67.0 KB)

Best regards
Manuel Memenga

@manuel.memenga

Thanks for getting back to us.

We have tested the scenario by using a sample image for ImageStamp as watermark with latest version of the API and we were unable to notice the issue which you have shown in the shared screenshot. Please check following code snippet for the image stamp properties which we used to add it inside your PDF. A sample output PDF is also attached for your kind reference.

imageStamp.VerticalAlignment = VerticalAlignment.Center;
imageStamp.HorizontalAlignment = HorizontalAlignment.Center;
imageStamp.Opacity = 0.5;
imageStamp.RotateAngle = 45;

WatermarkTest_out.pdf (106.9 KB)

Would you please share the same image which you have used for the watermark. We will again test the scenario with your image and let you know about our findings. We also request you to please try your scenario using Aspose.PDF for .NET 18.7 and share with us if issue still persists.

Hello,

we don’t use an image file but a PDF file as a watermark. The watermark can have several pages.
I have sent you the code and the files to use. I could reproduce the problem even in the v18.7.

Please use my sample code and files.

@manuel.memenga

We did not receive any code samples from your side. Would you please share sample code here in your post with necessary files to test the scenario. You can also share requested data in a private message.

Hello,

I sent the code in the second post. The files I had attached in the first post.

Here are all the necessary files and the code again:
WatermarkTest_Files.zip (180.3 KB)

Best regards
Manuel Memenga

@manuel.memenga

Thanks for sharing files again.

We were able to replicate the mentioned issue in our environment with latest version of the API. For the sake of correction, we have logged it as PDFNET-45198 in our issue tracking system. We will further investigate the issue in details and keep you posted with the status. Please be patient and spare us little time.

Meanwhile as a workaround, you may please convert PDF Page into Image and use that image for adding watermark via ImageStamp. We will let you know as soon as we have some updates regarding issue resolution.

We are sorry for the inconvenience.