I need to search an expression inside a xps document
then list all matches (with the page number of each match).
I searched in google, but no reference or sample found which addresses this issue .
SO: How can I search a xps document
and get this information?
The first thing to note is that an XPS file is an Open Packaging package. It can be opened and the contents accessed via the
System.IO.Packaging.Package
class. This makes any operations on the contents much easier.Here's an example of how to search the page content with a given regex, while also tracking which page the match occurs on.