GroupDocs.Watermark for .NET 24.7 Release Notes

The release of GroupDocs.Watermark version 24.7 contains one new feature and enhancement for the creating repeated watermarks (tile mode)

Full list of changes in this release

KeyCategorySummary
WATERMARKNET-1758★ FeatureReturn result with added watermarks in the Add method
#WATERMARKNET-1733EnhancementAbility to rotate tiled watermarks relative to the center of the document

Major Features

Return result with added watermarks in the Add method

🌐 Our new update introduces the ability to return results with added watermarks directly through the Add method. This feature ensures that every result generated can be seamlessly integrated with customizable watermarks, enhancing both security and branding for your documents. The unique GUID assigned to each watermark ensures precise tracking and identification of documents, offering clear visibility and control over your content distribution.

using (Watermarker watermarker = new Watermarker("test.pdf", new PdfLoadOptions()))
{
    // Create a text watermark with a specified text and font
    var watermark = new TextWatermark("watermark", new Font("Arial", 48));

    watermark.Opacity = 0.3;
    watermark.RotateAngle = -45;

    var result = watermarker.Add(watermark);
    foreach(var item in  result.Succeeded) 
    {
        Console.WriteLine("WatermarkId: {0}", item.WatermarkId);
        Console.WriteLine("WatermarkType: {0}", item.WatermarkType);
        Console.WriteLine("PageNumber: {0}", item.PageNumber);
        Console.WriteLine("WatermarkPosition: {0}", item.WatermarkPosition);
    }

    // Save the watermarked document and capture the watermarking result
    WatermarkResult watermarkResult = watermarker.Save("result.pdf");
}

Ability to rotate tiled watermarks relative to the center of the document

🌐 We’re excited to unveil a new feature that enhances the flexibility and precision of watermarking in your documents. With this update, you now have the ability to rotate tiled watermarks relative to the center of the document, giving you greater control over your watermark’s appearance and alignment. A New property RotateAroundCenter has been added in the TileOptions class.

using (Watermarker watermarker = new Watermarker("test.pdf", new PdfLoadOptions()))
{
    // Create a text watermark with a specified text and font
    var watermark = new TextWatermark("watermark", new Font("Arial", 48));  

    // Configure TileOptions
    watermark.TileOptions = new TileOptions()
    {
        LineSpacing = new MeasureValue()
        {
            MeasureType = TileMeasureType.Points,
            Value = 100
        },
        WatermarkSpacing = new MeasureValue()
        {
            MeasureType = TileMeasureType.Points,
            Value = 70
        },
    };

    watermark.RotateAroundCenter = true;
    watermark.Opacity = 0.3;
    watermark.RotateAngle = -45;

    // Add the text watermark with additional options 
    PdfArtifactWatermarkOptions textWatermarkOptions = new PdfArtifactWatermarkOptions();
    watermarker.Add(watermark, textWatermarkOptions);

    // Save the watermarked document and capture the watermarking result
    WatermarkResult watermarkResult = watermarker.Save("result.pdf");
}