Redaction formatting issue

I am evaluating this tool and a big part of what I need is redaction, The problem I am having is that the redacted text causes the formatting of the document to change. What I am seeing is the text I want redacted is removed and the filled redacted region is added in its place, the problem is all the text shifts and some of it moves under the redacted region an is now hidden.

Here is the code I am using, currently I am on the 30 day evaluation.

               

               //create TextAbsorber object to find all the phrases matching the regular expression
               TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber("text to redact"); 
                                                                                                      //set text search option to specify regular expression usage
               TextSearchOptions textSearchOptions = new TextSearchOptions(true);
               textFragmentAbsorber.TextSearchOptions = textSearchOptions;
               //accept the absorber for all the pages
               doc.Pages.Accept(textFragmentAbsorber);
               //get the extracted text fragments
               TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
               //loop through the fragments

               {
                 
                   //loop through the fragments
                   foreach (TextFragment textFragment in textFragmentCollection)
                   {
                       //  get page object containing the text fragment
                       Page page = textFragment.Page;
                       //  get rectangle for annotation taking into account RotationMatrix
                       Aspose.Pdf.Rectangle annotationRectangle = page.RotationMatrix.Reverse().Transform(textFragment.Rectangle);
                       //  create RedactionAnnotation instance for specific page region
                       Aspose.Pdf.Annotations.RedactionAnnotation annot = new Aspose.Pdf.Annotations.RedactionAnnotation(page, annotationRectangle);
                       //Console.WriteLine(textFragment.Rectangle.ToString());
                         
                       annot.FillColor = Aspose.Pdf.Color.Black;
                       annot.BorderColor = Aspose.Pdf.Color.Yellow;
                       annot.Color = Aspose.Pdf.Color.Blue;
                       // text to be printed on redact annotation
                       // annot.OverlayText = "REDACTED";
                       annot.TextAlignment = Aspose.Pdf.HorizontalAlignment.Center;
                       // repat Overlay text over redact Annotation
                       annot.Repeat = true;
                       // add annotation to annotations collection of first page
                       doc.Pages[textFragment.Page.Number].Annotations.Add(annot);
                       // Flattens annotation and redacts page contents (i.e. removes text and image
                       // under redacted annotation)
                       //annot.Flatten();
                       annot.Redact();
                   }
               }

              doc.Save("./SampleDocs/Redacted.pdf");

Hi Akeem,

Thanks for contacting support.

Would you please share an input document, so that we can test the scenario in our environment and address it accordingly. As for now, attaching files with post is creating problem, so you can upload your sample document to some public file sharing website and share the link here. We are working over fixing the upload feature of forums and soon it will be available.


Best Regards,
Asad Ali

here is the file i am using.

https://drive.google.com/file/d/0Bw3bi-DdVfmTaTZYUW9PeGlHNjA/view?usp=sharing

As a test I am redacting out the word “Aspose”

Hi Akeem,

Thanks for sharing input document.

I would like to share with you that file upload issue has been resolved now and from now on, you can attach sample file(s) with your post.

Now concerning to the Redaction, I have tested the scenario in our environment and noticed that the text formatting got disturbed after adding RedactionAnnotation and some of the text characters also shifts below the rectangle of annotation. Therefore, I have logged an issue as PDFNET-42937 in our issue tracking system, for the sake of correction.

We will further investigate the reasons, causing the issue and keep you posted with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.


Best Regards,
Asad Ali

do you have an estimate on when this would be resolved, I need to know if its feasible to wait for this or start evaluating other options.

Hi Akeem,

As we just have been able to notice this issue, so it is pending for review and unless the product team completes evaluation, we may not be able to share the possible timelines regarding its resolution. Please be patient and spare us little time.

Is there any way of knowing if this is going to get fixed soon? Seems to me this bug makes the redaction feature unusable

@aboatswain

Thanks for your inquiry.

I have checked the status of earlier logged issue and I am afraid it is not resolved yet. Please note that there are other issues which are pending in the queue and logged prior to yours. Our product team will definitely plan to resolve your issue after resolving them, as per their development schedule. As soon as we have some definite updates, we will certainly inform you. Please give us little time.

We are sorry for the inconvenience.


Best Regards,
Asad Ali

is there any updates on this issue or is there some sort of workaround, unless I’m mistaken this bug makes the redaction feature unusable.

I also waiting for the redaction as well.

@aboatswain,
The linked ticket ID PDFNET-42937 is pending for the analysis and not resolved yet. Unfortunately, there is no workaround at the moment. We have logged an ETA request under the same ticket ID PDFNET-42937. We will let you know once a significant progress has been made in this regard.

@george.soto,
Please note, the redaction feature is supported and if you are facing any issue, then kindly share all details of the use case. We will investigate and share our findings with you. Please refer to this help topic: Redact certain page region with RedactionAnnotation

Best Regards,
Imran Rafique

Hi, I am also seeing this issue - PDFNET-42937 - and need a resolution. Has this issue been resolved?

@paulsachs

Thanks for your inquiry.

I am afraid that earlier logged issue has not been yet resolved due to high numbers of pending issues in the queue. As soon as we receive some updates, regarding resolution progress of the issue, we will let you know. Please be patient and spare us little time.

We are sorry for the inconvenience.

Hi, I am also facing the same issue & not able to use the library for other features also as I do want redact too.

@Dhanwate_Yogesh_Hiraman,

Kindly send all details of your scenario, including source PDF and code. We will investigate your scenario in our environment, and then share our findings with you. Your response is awaited.

Below is the source code I am using for redact-
static void MarkForRedactionAndRedact()
{
string dataDir = @"…\InputPdf";

        Document doc2 = new Document(dataDir + "SampleInputToTestRedact.pdf");
        TextFragmentAbsorber tfa = new TextFragmentAbsorber("patients");
        doc2.Pages[2].Accept(tfa);

        foreach (TextFragment redactAnnotation in tfa.TextFragments)
        {
            RedactionAnnotation ha = new RedactionAnnotation(doc2.Pages[2], redactAnnotation.Rectangle);
            ha.Color = Color.Red;
            doc2.Pages[2].Annotations.Add(ha);

            ha.Redact();
        }

        doc2.Save(dataDir + "SampleInputToTestRedact_Out.pdf");
        
    }<a class="attachment" href="/uploads/default/13193">SampleInputToTestRedact.pdf</a> (262.5 KB)

SampleInputToTestRedact_Out.pdf (304.4 KB)

The input fileSampleInputToTestRedact.pdf (262.5 KB)

@Dhanwate_Yogesh_Hiraman,

We can view redaction on the second page of the output PDF. Please share details about the problematic area with the help of a snapshot. Your response is awaited.

Please see the input pdf and output pdf side by side. last character from previous word that of target word for redact is missing.

@Dhanwate_Yogesh_Hiraman,

We managed to replicate the said problem of missing characters in our environment. It has been logged under the ticket ID PDFNET-44467 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.