Add stamp in PDF document using Aspose.PDF for .NET - artifacts in each corner around stamp

Hi,

I will have to iterate several pdf documents and attach different stamps, basically just pdf documents containing an image, to them depending on some condition.

The document I used for stamping works fine. However the second stamp, which is a bit older I think, are having some issues. It seems to introduce these artifacts in each corner. Look at the following example:
Annotation 2020-06-30 154222.png (12.6 KB)

I had to cover up some secret stuff in blue. The thing to note here is the 2 lines that has appeared in every corner. These do not appear in my first stamp, only the second. It almost looks some sort of alignment thing.

I have been debugging this for hours. The stamps have the same properties, height, width, etc. The only difference between them is the font. The first stamp uses Verdana:
Verdana-Identity-H
Verdana-Bold-Identity-H
Verdana-Italic-Identity-H

The second stamp is using Century Old:
CenturyOldStyleStd-Regular
CenturyOldStyleStd-Regular
CenturyOldStyleStd-Bold

However when stepping through with the debugger, all fonts are embedded and accessible so perhaps this is not the culprit here. On my local machine I only have Verdana installed as Century is a paid font from Adobe.

What could introduce these artifacts to my pdf? Is something wrong with my second stamp pdf?

@stebe95

We need to further investigate the scenario and for that, we need sample PDF along with code snippet that you are using. We will test the scenario in our environment and address it accordingly.

Ok, I’ve sent you a message.

@stebe95

We have tested the scenario in our environment using Aspose.PDF for .NET 20.6 and your files. We were able to observe the similar issue. Therefore, we have logged it as PDFNET-48496 in our issue tracking system for the sake of investigation. 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.

Great that you ran into the same issue. :slight_smile:

Looking forward to your findings and potential solution!

How long time can I expect to wait until your development team has had a chance to look into this issue?

@stebe95

The issue has recently been logged under free support model and it is pending for analysis. It will be investigated and resolved on first come first serve basis. We are afraid that we cannot share any ETA at the moment as investigation of the issue has not been done. We will let you know as soon as we have some definite updates in this regard. Please spare us some time.

We are sorry for the inconvenience.

Hi, has there been any updates on this issue?

I looked around for a couple of hours and finally found a solution that works instead. I load the pdf, extract the image and then insert it like this instead:

                using (FileStream imageStream = new FileStream("image_out" + ".jpg", FileMode.Create))
                {
                    Resolution resolution = new Resolution(300);
                    JpegDevice jpegDevice = new JpegDevice(resolution, 100);
                    Document imagePdfDocument = new Document(imageFilePath);
                    jpegDevice.Process(imagePdfDocument.Pages[1], imageStream);
                    Page imagePdfDocumentFirstPage = imagePdfDocument.Pages.First();
                    double LowerLeftX = stickXPoint - imagePdfDocumentFirstPage.Rect.LLX + imagePdfDocumentFirstPage.CropBox.LLX;
                    double LowerLeftY = pageHeight - (stickYPoint + imagePdfDocumentFirstPage.Rect.Height + imagePdfDocumentFirstPage.Rect.LLY) + imagePdfDocumentFirstPage.CropBox.LLY;
                    double UpperRightX = LowerLeftX + imagePdfDocumentFirstPage.Rect.Width;
                    double UpperRightY = LowerLeftY + imagePdfDocumentFirstPage.Rect.Height;
                    pdfDocument.Pages[1].AddImage(imageStream, new Rectangle(LowerLeftX, LowerLeftY, UpperRightX, UpperRightY));
                }

However, this solution is not optimal either because the when I save the pdf tp the imagestream with the JpegDevice, fonts are not included and Apose defaults to something else. Also using this method increases the size of the final pdf by about 100KB. And besides, the image is still a bit blurry when zooming in. I cannot increase the resolution much now because the size increases a lot. So this is not a viable workaround.

@stebe95

Thanks for sharing further details.

We are afraid that earlier-logged ticket is not yet resolved. However, we have updated it as per your provided information and will surely consider it during anlaysis. We will inform you as soon as we make some progress towards issue resolution. Please give us little time.

We are sorry for the inconvenience.