GroupDocs.Watermark for .NET 24.8 Release Notes

The release of GroupDocs.Watermark version 24.8 contains several enhancements and bug fixes.

Full list of changes in this release

KeyCategorySummary
#WATERMARKNET-1760EnhancementAdd PageNumber in the result of search operation
#WATERMARKNET-1800EnhancementAdding annotation watermark in the pdf document takes long time
WATERMARKNET-1793🔧 FixPagesSetup option used zero based pages
WATERMARKNET-1799🔧 FixWrong page number returned when adding watermark in the Word header/footer

Major Features

Add PageNumber in the result of search operation

🌐 We are excited to introduce a new enhancement that adds page numbers to the results of search operations. This feature will allow users to easily navigate through large sets of search results by clearly indicating the current page within the result set.

 using (Watermarker watermarker = new Watermarker(documentPath))
{
    PossibleWatermarkCollection possibleWatermarks = watermarker.Search();
    foreach (PossibleWatermark possibleWatermark in possibleWatermarks)
    {       
        Console.WriteLine(possibleWatermark.Text);
        Console.WriteLine(possibleWatermark.X);
        Console.WriteLine(possibleWatermark.Y);
        Console.WriteLine(possibleWatermark.RotateAngle);
        Console.WriteLine(possibleWatermark.Width);
        Console.WriteLine(possibleWatermark.Height);
        Console.WriteLine(possibleWatermark.PageNumber);
    }
}

Adding annotation watermark in the pdf document takes long time

🌐 We have implemented significant optimizations to address the issue of long processing times when adding annotation watermarks to PDF documents. This enhancement reduces the time required to apply watermarks, particularly in large or complex documents.

using (Watermarker watermarker = new Watermarker("test.pdf",))
{
    PdfAnnotationWatermarkOptions options = new PdfAnnotationWatermarkOptions();

    // Add text watermark
    TextWatermark textWatermark = new TextWatermark("This is a annotation watermark", new Font("Arial", 8));
    textWatermark.HorizontalAlignment = HorizontalAlignment.Left;
    textWatermark.VerticalAlignment = VerticalAlignment.Top;
    watermarker.Add(textWatermark, options);

    watermarker.Save(outputFileName);
}

PagesSetup option used zero based pages

🌐 We have identified and resolved an issue where the PageSetup option incorrectly uses zero-based numbering for pages. This can cause confusion as page numbers displayed or referenced may not align with the expected one-based numbering convention commonly used in documents.

using (Watermarker watermarker = new Watermarker("test.pdf",))
{
    PdfArtifactWatermarkOptions options = new PdfArtifactWatermarkOptions();

    // Add text watermark
    TextWatermark textWatermark = new TextWatermark("This is a annotation watermark", new Font("Arial", 8));
    textWatermark.HorizontalAlignment = HorizontalAlignment.Left;
    textWatermark.VerticalAlignment = VerticalAlignment.Top;
    var pages = new System.Collections.Generic.List<int>() { 1, 3 };

    textWatermark.PagesSetup = new PagesSetup
    {
        Pages = pages
    };

    watermarker.Add(textWatermark, options);
    watermarker.Save(outputFileName);
}