GroupDocs.Watermark for .NET 23.7 Release Notes

Major features

There are the following enhancements in this release:

  • Resolved the issue: Watermark is not being removed

Full List of Issues Covering all Changes in this Release

KeySummaryIssue Type
#WATERMARKNET-1450Watermark is not being removedFeature

Public API and Backward Incompatible Changes

Public API changes

Class PdfOperator has been added to GroupDocs.Watermark.Contents.Pdf namespace.
Class PdfOperatorCollection has been added to GroupDocs.Watermark.Contents.Pdf namespace.
Class PdfFindVectorWatermarkStategy has been added to GroupDocs.Watermark.Contents.Pdf namespace.
Class VectorSearchCriteria has been added to GroupDocs.Watermark.Search.SearchCriteria namespace.
Class PdfVectorPossibleWatermark has been added to GroupDocs.Watermark.Search.Watermark namespace.

Use cases

The following example demonstrates the use of searching for vector watermarks by color and brightness in order to remove them from a PDF file.

string inputFilePath = "Input.pdf";
string outputFilePath = "Output.pdf";

using (Watermarker watermarker = new Watermarker(File.OpenRead(path)))
{
    var pdfContent = watermarker.GetContent<PdfContent>();
    var searchCriteria = new VectorSearchCriteria();
    var watermarkColor = ColorTranslator.FromHtml("#a9aaae");
    var fromSystemColor = GroupDocs.Watermark.Watermarks.Color.FromArgb(watermarkColor.A, watermarkColor.R, 
    	watermarkColor.G, watermarkColor.B);

    var criteriaVectorColorRange = new ColorRange(fromSystemColor)
    {
        MinBrightness = 0.1f,
        MaxBrightness = 0.7f
    };

    searchCriteria.VectorColorRange = criteriaVectorColorRange;

    var possibleWatermarkCollection = pdfContent.Search(searchCriteria);
                
    possibleWatermarkCollection.Clear();

    watermarker.Save(outputFilePath);
}