Editing WPF XPS

I like DocumentViewer to display an XPS document in a WPF application. But I also need to modify the XPS document. I found standalone applications (.exe) for editing XPS. I need a WPF control to view and edit XPS. Or an extension for DocumentViewer for editing. The editors should actually delete the data, and not just hide it (this is for the trial application). Does anyone know a way to view and edit XPS in WPF?

+4
source share
2 answers

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

If you can identify the ranges of text you want to change, you can replace the glyphs with a black visual one and not add a text range to the resulting document.

...

Hm. When I typed above, it really sounds a little complicated when there are simpler solutions.

  • Read the XPS document, convert it to a FlowDocument.
  • Allow the user to select ranges of text to change.
  • Replace * selected text with โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ (U + 2588, full block).
  • Convert the document back to XPS and print.

* When you replace the source text, it will not be available in the copy / paste actions.

There are many guides for each of these steps separately. Let me know if you need more help.

+3
source

If my mind is not lying, you cannot edit XPS directly, but you can create a WPF document view, edit it and print it to a new XPS file.

+1
source

Source: https://habr.com/ru/post/1380201/


All Articles