WPF XPS Redaction

926 views Asked by At

I like DocumentViewer for display of an XPS document in a WPF application. But I also need to redact the XPS document. I have found stand alone applications (.exe) for redacting XPS. What I need is a WPF control for view and redaction of XPS. Or an extension to DocumentViewer for redaction. The redaction must actually remove the data and not just hide it (this is for a litigation application). Does anyone know of way to view and redact XPS in WPF?

2

There are 2 answers

0
Dennis On BEST ANSWER

With a custom DocumentPaginator you can control how each element of the document is printed.

If you can identify the text ranges you want to redact then you can replace the glyphs with a black visual and not add the text range to the final document.

...

Hmm. As I typed the above it really sounds a bit complex when there are simpler solutions.

  1. Read the XPS document, convert it to a FlowDocument.
  2. Allow the user to select text ranges to redact.
  3. Replace* the selected text with the ████████████████ character (U+2588, Full Block).
  4. Convert the document back to XPS and print.

* As you replaced the original text, it will not be available in copy/paste actions.

There are plenty of tutorials on how to each the above steps separately. Let me know if you need any additional help.

1
Arman Hayots On

If my mind don't lie, you can't edit XPS directly, but you can create WPF representation of document, edit it and print to new XPS file.