Question:
How can I search a document for a strings of text and create redaction annotations (but not apply the redactions) before viewing the document in WebViewer?
Answer:
If you want to search a document for specific text and create redaction annotations before viewing the document in WebViewer, you can use the TextSearch API along with the redaction API.
Here’s a code sample showing how this can be achieved.
This code sample first specifies the text to search using a regex pattern, then uses the TextSearch API to find all instances of the text in the document. It then retrieves the highlight data of the text instances to get the coordinates of each instance, using the Redaction API to create annotations for each instance. Finally, it opens the document in WebViewer for viewing.
Note that this code creates the redaction annotations on top of the document, but does not actually apply the redactions to the document, allowing you to edit the redactions before they’re burned in.
If you’re hoping to apply the annotations before opening the document in WebViewer, check out the community post linked here.