Hi, I’m evaluating GroupDocs.Watermark .NET APIs for my company,
I noticed that adding watermarks to docx, xlsx, pptx files are very slow,
it takes about 20 seconds to add watermarks to a 20 pages 1.02MB pptx file.
I did a simple profile, it seems GroupDocs.Watermark.Watermarker.ctor() is the bottleneck:
image.png (15.3 KB)
My question:
- Is this normal?
- Is this because I’m using a trial version of the GroupDocs.Watermark product?
- What can I do to improve the performance of adding watermarks?
@wangfu91
Please share following details and we’ll investigate this issue:
- API version (e.g. 19.10, 20.4) that you’re evaluating
- Sample code that you’re using to add watermark
- Sample PPTX file
Thanks for the reply,
It seems to be Windows Defender’s fault, after disable Defender’s real-time scan,
the elapsed time dropped to 4.7 seconds.
- API version: GroupDocs.Watermark for NET 20.7.0
- Sample code:
class Program
{
static void Main(string[] args)
{
try
{
var file = @"Microsoft Sway.pptx";
var fileName = Path.GetFileNameWithoutExtension(file);
var ext = Path.GetExtension(file);
var sw = Stopwatch.StartNew();
using (Watermarker watermarker = new Watermarker(file))
{
TextWatermark watermark = new TextWatermark("Confidential", new Font("Arial", 24));
watermark.HorizontalAlignment = HorizontalAlignment.Center;
watermark.VerticalAlignment = VerticalAlignment.Center;
watermark.RotateAngle = -45;
watermark.SizingType = SizingType.ScaleToParentDimensions;
watermark.ScaleFactor = 1;
watermark.Opacity = 0.4;
watermarker.Add(watermark);
watermarker.Save($"{fileName}-Watermarked{ext}");
}
var elapsed = sw.ElapsedMilliseconds;
sw.Stop();
Console.WriteLine($"Takes {elapsed} ms");
}
catch (Exception)
{
throw;
}
}
}
@wangfu91
We enabled Windows defender and the antivirus. It took 4-5 seconds. Please have a look at this screenshot.PNG (68.5 KB).
After more tests, this seems only happen on my development machine, and only on the first run.
I don’t think it is GroupDocs 's issue, closing it, thanks for the reply.
1 Like