Png watermark producing black rims

Hi Aspose Support,

We are currently using Aspose.Pdf for .NET Version 16.12.0.0.
We are planning to buy a new subscription for the latest versions of the Aspose libraries, but only if our issues will be solved with this…

Our goal is, to add watermarks to every page of an existing PDF document. Further goals are a fast execution and small pdf file sizes.
We are currently using the approach suggested by Farhan.Raza here: Fastest way to add a watermark - #4 by Farhan.Raza

When opening the resulting file with a pdf viewer (a browser will not show you enough detail!), there are black rims on the border between the painted and the transparent sections of the image. You can see them best on the border of the circular logo. Since the files will be sent by email, we do not want these rims to appear.

I set up a small testing project for you to reproduce the issue. The used PDF document and the image are included in the projects root directory.

Please let me know if there is any other approach we should try or if this issue is fixed in a later version of Aspose.Pdf.

@kammererm

Thanks for contacting support.

In case you are working with image watermarking, you may achieve it using ImageStamp also. Please check following sample code snippet:

Document pdfDocument = new Document(dataDir + "Sample PDF.pdf");
ImageStamp imageStamp = new ImageStamp(dataDir + "logo.jpg");
imageStamp.Background = true;
imageStamp.HorizontalAlignment = HorizontalAlignment.Center;
imageStamp.VerticalAlignment = VerticalAlignment.Center;
imageStamp.Opacity = 0.5;
pdfDocument.Pages[1].AddStamp(imageStamp);
dataDir = dataDir + "Watermark_out.pdf";
pdfDocument.Save(dataDir);

Please note that with every revision of the API, performance and memory consumption by the API is improved. In case you are facing any issue related to processing time of documents, please share some sample PDF documents with us. We will test the scenario in our environment and address it accordingly.

In case you have any sample project, it would be really appreciable if you can share it with us. We will further test it in our environment and share our feedback with you.

Hi asad.ali,

Please note as well, that we are using a PNG image, because there is not transparency in JPG.
Thanks for your code example. I tried this approach as well, but the rims where showing up this way as well.
But you could not know, since the upload of my test project did not seem to work.

Because of this, I uploaded my project on a server, so you can download it from here:
www.novasoftware.de/Aspose/AsposeWatermarkTest.zip

@kammererm

Thank you for sharing requested data.

We are looking into it and will share our feedback with you soon.

@kammererm

We have been able to reproduce the issue in our environment. A ticket with ID PDFNET-45969 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.