We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

RedactionAnnotation Popup

Hello, while using Aspose.PDF 18.1, there seems to be no way to remove a popup associated with a redaction annotation. RedactionAnnotation does not have a Popup property similar to MarkupAnnotation and the PopupAnnotation’s Parent property throws InvalidCast exception when accessed.

We would like to process RedactionAnnotation and its Popup together and there does not seem to be a way available now.

Can you pls let me know how this can be handled?



Thanks for contacting support.

Would you please share your sample code snippet along with a sample PDF document, so that we can test the scenario in our environment and address it accordingly. Please also try to share the screenshot of the popup associated with redaction annotation.

Here is the screenshot:
image.png (19.0 KB)

The attached file contains one redaction annotation and its associated popup.
sample_redaction_annotation.pdf (29.5 KB)

Below is sample code that processes annotations in a page:

foreach (Annotation annotation in page.Annotations)
                                        Console.WriteLine("Annotation Type: {0}", annotation.ToString());

                                        if(annotation is RedactionAnnotation)
                                            //TODO: Process popup here:
                                            var ra = annotation as RedactionAnnotation;
                                            ra.Popup // <- This does not exists in Aspose API                                

                                        if(annotation is PopupAnnotation)
                                            var popup = annotation as PopupAnnotation;
                                            var ra = popup.Parent; // This like throws invalidcast exception

Let me know if any further questions. thanks.


Thanks for sharing requested details.

We have tested the scenario in our environment using following code snippet and observed that there are two annotations added in the shared PDF document. The popup was not associated with the RedactionAnnotation - instead it has been added separately inside PDF. If you execute below code snippet, you will notice that it will return two annotations (i.e RedactionAnnotation and PopupAnnotation) . Annotations.png (1.6 KB)

In case you want to remove the popup from your PDF, you may delete it using Page.Annotation.Delete() method. We have removed popup from your PDF document using following code snippet. For your kind reference, an output PDF has also been attached.

int i = 0;
Document doc = new Document(dataDir + "sample_redaction_annotation.pdf");
foreach (Annotation annotation in doc.Pages[1].Annotations)
 Console.WriteLine("Iteration # : " + i.ToString());
 Console.WriteLine("AnnotationType : " + annotation.AnnotationType.ToString());
 if (annotation.AnnotationType == AnnotationType.Popup)
doc.Save(dataDir + "sample_redaction_annotation_out.pdf");

sample_redaction_annotation_out.pdf (27.6 KB)

Furthermore, we have also observed that while accessing PopupAnnotation.Parent property, System.InvalidCastException Exception occurred. For the sake of investigation we have logged this issue as PDFNET-44181 in our issue tracking system. We will further look into the details of the logged 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.

Thank you for the update. Popup not associated with Redact annotation is also an issue with Aspose. See below redact_annotatopn.png (36.6 KB)

From PDF contents we can see that Popup is associated with redaction annotation, that is the reason why viewers like Acrobat reader will show that popup when you select redaction.

We are aware of how to delete popup annotation, the scenario is to remove only popups associated with redact annotation, not all of them.

Thanks for creating the bug item, any ETA on when this shall be fixed?


Thanks for writing back.

Since the RedactionAnnotation does not have the property of Popup, so we cannot associate PopupAnnotation with it. Though we can add separate PopupAnnotation with the same rectangle size which will overlay the added redaction. In the image, which you have shared, you can notice that there are two annotations in the annotation array of the PDF. I have added a RedactionAnnotation to a sample PDF document and checked it in the Adobe Reader - I was unable to notice the Popup. Please check attached PDF document.

Redacted.pdf (3.4 KB)

Now that issue has been logged in our issue tracking system, our product team will investigate it as per their development schedule, after resolving the other pending issues in the queue which were logged prior to this issue. As soon as we receive some definite updates, regarding resolution of the issue, we will let you know. Please spare us little time.

We are sorry for the inconvenience.

Thank you for the update. Redacting document has two stages. Marking and Applying. The document and the issues I mentioned are basically redactions in the marked state. They have not been applied yet. Once the reduction has been applied, there is no annotation left, which is the case with the document you shared.

Typically, when users redact using Acrobat or other editors when they are in the Marking state, there is a popup associated with the redaction.

My point is, if you look at the image shared previously, it clearly shows popup as the child element of redaction annotation.

However, Aspose API does not have a popup property. For example, all the annotations derived from MarkupAnnotation have that property and I think, RedactionAnnotation class should have one as well. Please discuss with your technical team and let us know if this can be fixed.

Let us know if any further questions.

Thank you.


Thanks for adding more details to your requirements.

We have generated an enhancement request under the ticket PDFNET-44215 in our issue tracking system and associated it with your post. Our product team will further investigate the feasibility of this enhancement and we will let you know once a significant progress is made in this regard. Please be patient and spare us little time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFNET-44215,PDFNET-44181) have been fixed in Aspose.PDF for .NET 22.1.