You are viewing limited content. For full access, please sign in.

Question

Question

remove all redactions from a document

asked on December 8, 2014

I would like to reprocess a set of documents that already contain redactions (they are incorrect).  I'd like to be able to search for this set of documents, then for each one, remove the existing annotations (both image and text redactions).  Workflow does not seem to be able to do this unless it is done through an SDK activity. Would a code snippet be available?

Thank you in advance!

 

Kyle Knebel

Cities Digital
 

0 0

Answer

SELECTED ANSWER
replied on December 8, 2014

I haven't tested this code, but it should be enough to get you started:

private void DeletAllRedactions(DocumentInfo doc)
{
    using (var pages = doc.GetPageInfos())
    {
        foreach (var page in pages)
        {
            foreach (var redaction in page.GetAnnotations().Where(annot => annot.AnnotationType == AnnotationType.Redaction))
            {
                redaction.Delete();
            }
            page.Save();
        }
    }
}

 

 

1 0

Replies

replied on December 9, 2014

It is better to call DocumentInfo.GetAnnotations instead of looping through each page and getting the annotations, if any, for each.

private void DeletAllRedactions(DocumentInfo doc)
{
    foreach (var redaction in doc.GetAnnotations().Where(annot => annot.AnnotationType == AnnotationType.Redaction))
    {
        redaction.Delete();
        redaction.Save();
    }
}

 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.