Time adding watermark to a PDF programatically using c# .NET

We have downloaded the version 24.5 to evaluate it.
We have been testing the time it takes adding watermarks to a PDF file used as a manual (in this case a file with more than 200 pages with images, index, etc). And it takes more than 2 minutes adding the watermark.
For us, it is too long time.
We had a previous version 18.8, but it creates problems when we add watermaks to Word documents (it added a line per each Watermark in each page).
Can we check if the time adding the watermark in PDF is less in a non-evaluation version?
We are interested in it, but this time is excesive for us.

@MikelGB

Could you please share the problematic file (if it’s a large file, compress it to ZIP, upload to Google Drive and share link ) and the sample Watermark code? We’ll then investigate this issue at our end.

There are API evaluation limitations. We could further check it if you share sample file and the code with us.

We have been adding the Watermark to the PDF with a code as:

            PdfLoadOptions loadOptions = new PdfLoadOptions();
            using (Watermarker watermarker = new Watermarker(fileToFillPath, loadOptions))
            {
                // Build the text to be written in the Watermark
                string strWatermark = GetStringWatermark(fileToFillPath);

                PdfArtifactWatermarkOptions options = new PdfArtifactWatermarkOptions();
                // Create text watermark

                //initialize the font to be used for watermark1
                GroupDocs.Watermark.Watermarks.Font font = new GroupDocs.Watermark.Watermarks.Font("Arial", 40, GroupDocs.Watermark.Watermarks.FontStyle.Regular);
                TextWatermark textWaterMark = new TextWatermark(strWatermark, font);
                textWaterMark.ForegroundColor = GroupDocs.Watermark.Watermarks.Color.Blue;
                textWaterMark.BackgroundColor = GroupDocs.Watermark.Watermarks.Color.Beige;
                textWaterMark.HorizontalAlignment = GroupDocs.Watermark.Common.HorizontalAlignment.Center;
                textWaterMark.VerticalAlignment = GroupDocs.Watermark.Common.VerticalAlignment.Top;
                textWaterMark.TextAlignment = TextAlignment.Center;
                textWaterMark.Opacity = 0.3;
                textWaterMark.RotateAngle = 0;
                textWaterMark.Margins = new Margins(MarginType.RelativeToParentDimensions, 0.1, 0.1, 0.1, 0.1);

                textWaterMark.SizingType = SizingType.ScaleToParentDimensions;
                textWaterMark.ScaleFactor = 0.3;

                //apply the watermark
                watermarker.Add(textWaterMark, options);

                //save the changes
                watermarker.Save();
            }

And the example PDF to add the Watermark is: manual-dlp-example.zip - Google Drive

This task (jusy adding the watermark) takes a minute for us, and more actions are executed later. Adding the watermark would require most the time, and too long.

Can we optimize the action of adding the watermark? Or the WM added in the evaluation mode of exacution adds too much time? Or, perhaps, is there a size limite for a right execution?

We are analyzing the library to see if it is Ok for us to adquire it.

@MikelGB

We followed the code and problematic file that you shared. It took almost 25 seconds with API version 24.6, please take a look at this screenshot (138.2 KB).
Could you please share a sample application to reproduce the issue? Also share the development environment details (e.g. OS details, .NET version).

Hi,
In a Word document, the Watermark can be associated with HeaderFooter and it is assigned much faster.
I need for PDF to add a Dynamic Watermark (added each time the file is accessed). I had this with GrupDocs.Watermark version 18.8 and there was an option faster, calling to:
//apply the watermark
foreach (var page in doc.Pages)
{
page.AddAnnotationWatermark(textWaterMark, false);
}

I test it and it was executed in a faster way in PDF (in version 18.8). But i see it can not be implemented in this way now.
But version 18.8 had problems to add Watermarks in Word files.

Regards,

Mikel

@MikelGB

Could you please share a simple console application to add Watermarks dynamically in PDF? We need to see how you are doing it and please also mention the number of PDF files you are processing and how much time it takes for each.
Moreover, we would like to add that if you utilize API without license, you face some limitations. Please request a temporary license here and try the web app again.

Hello @MikelGB

Thank you for using our product.
Let me update you, that during the trial limitations each document page will have a trial watermark that potentially slows the process of saving the file. I would recommend ordering a temporary license and ensuring big documents can be processed with better performance.
Also please be aware that the latest version has new Tiling options and other new features.
We will try to investigate the shared document and get back to you shortly.

Hello,

In the response Atir sent me a response a week ago, he informed that it took almost 26 seconds for him to add a Watermark to this PDF with an API 24.6 (it is a very long time for us).
I understand he executed with full license.
I do not understand why the executions was faster in older versions for PDF files (but this older versions created problems with Word files).
And in little PDF files it takes to me 5 or 6 seconds only for adding the Watermark, so muy program would require more time for Watermarking than for all the tasks we must execute in our program.

HI @MikelGB

That’s right, but execution time depends of the particular running machine parameters.

I asked the GroupDocs.Watermark’ lead developer to run it and it took about 10 seconds. So maybe the best way would be to request a temporary license and ensure the product performs appropriately for your workflow on your server equipment.