How to clear Actions on Annotations

I have code that is removing Actions from Annotations (in this case, Link annotations) in a PDF file. Three sets of questions:


1) in one case, I am attempting to set the action to be null:

if (cleanAction(aac.OnClosePage)) aac.OnClosePage = null;

Is this the appropriate way to remove an action? Is there a better way to remove an action?

2) I can also set the JavaScript to be an empty string if that is part of the action tied to the document. Is it better to use a JavaScriptStripper?

3) For PDF Bookmarks/Outline, is there a best practice to delete actions on those items?

Thank you,
Michael

Hi Stacy,

I have code that is removing Actions from Annotations (in this case, Link annotations) in a PDF file. Three sets of questions:

  1. in one case, I am attempting to set the action to be null:
    if (cleanAction(aac.OnClosePage)) aac.OnClosePage = null;
    Is this the appropriate way to remove an action? Is there a better way to remove an action?

Yes, you are following the exact option to remove an action.

  1. I can also set the JavaScript to be an empty string if that is part of the action tied to the document. Is it better to use a JavaScriptStripper?

Both options are fine to remove JavaScript.

  1. For PDF Bookmarks/Outline, is there a best practice to delete actions on those items?

Please remove Bookmark as suggested in the documentation to delete a Bookmark.

Best Regards,

Thank you for the response. On the final question, is there anyway to remove the actions on a bookmark without actually deleting the bookmark?

Freedom Solutions:
Thank you for the response. On the final question, is there anyway to remove the actions on a bookmark without actually deleting the bookmark?
Hi Stacy,

Thanks for your patience and sorry for the delayed response.

I am afraid currently Aspose.Pdf for .NET does not support the feature to remove action associated with bookmark. For the sake of implementation, I have logged this requirement as PDFNEWNET-36634 in our issue tracking system. We will further look into the details of this requirement and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.