Free Support Forum - groupdocs.com

Error removing watermark from PDF


#1

I am using a temp license.
Getting Below exception:
An unhandled exception of type ‘System.NullReferenceException’ occurred in Aspose.Pdf Additional information: Object reference not set to an instance of an object.

Error Line:
PossibleWatermarkCollection possibleWatermarks = doc.FindWatermarks();

Below is the full code used:
string FilePath= @“E:\Pdf\Confidential PDF 2 (Writer).pdf”;
// For complete examples and data files, please go to https://github.com/groupdocs-watermark/GroupDocs.Watermark-for-.NET
using (PdfDocument doc = Document.Load(FilePath))
{
// Initialize search criteria
ImageSearchCriteria imageSearchCriteria = new ImageDctHashSearchCriteria(@“E:\ZonesCorp\Deployment\ZC\images\icons.png”);
TextSearchCriteria textSearchCriteria = new TextSearchCriteria(“CONFIDENTIAL”);

            //PossibleWatermarkCollection possibleWatermarks = doc.Pages[0].FindWatermarks(imageSearchCriteria.Or(textSearchCriteria));
            TextSearchCriteria searchCriteria = new TextSearchCriteria("CONFIDENTIAL", false);
            PossibleWatermarkCollection possibleWatermarks = doc.FindWatermarks();
            // Remove all found watermarks
            for (var i = possibleWatermarks.Count - 1; i >= 0; i--)
            {
                possibleWatermarks.RemoveAt(i);
            }

            doc.Save();

#2

@ali.mds,

Please provide us the following details so that we can investigate the issue at our end.

  • Problematic PDF document
  • Version of GroupDocs.Watermark for .NET API

#3

Hi Usman,
Confidential PDF 2 (Writer).pdf (113.3 KB)
The version of GroupDocs.Watermark is 19.5.1.0.

Thanks


#4

@ali.mds,

We are able to reproduce your reported issue at our end. This issue has been logged into our Issue Tracking System as WATERMARKNET-1143 for further investigation. We shall notify you here as soon as we have any updates for you.


#5

Hi Usman,
Thanks for your quick action.

Appreciate if issue could be resolve in this week as we are in mid of a POC.

Regards


#6

@ali.mds,

We shall try our best to fix the issue as soon as possible, however, we can not guarantee any ETA at the moment. We appreciate your cooperation in this regard.