Problem Description

How to edit the XML of a part of an XPS file?

Solution

The inspector tool allows you to edit the raw XML of any part of the XPS file.

A word of caution: this is a fairly dangerous way to edit an XPS file, so please be careful as you risk damaging the XPS file in such a way that it cannot be used anymore.

In this example we are going to add some xml comments to the first page. This is not a change that will influence the visual appearance of the file, but the spec allows comments to be part of the xml. It could be useful to mark certain sections in an XPS, marks which can later on be used by another tool.

Step 1: open the XPS documents (file.xps) that you want to modify

Via the file menu you can select the 'open' menu item which allows you to open files.

Step 2: open the inspector

Open the inspector, which you can find in menu under 'Tools>Inspector...', or by clicking on the following icon: - This will bring up the inspector.

Step 3: select the first page in the 'Package Tree'

Select the 'Package Tree' tab, and by expanding the tree control you can reveal the 1.fpage file. Typically you can find this in '/Documents/1/Pages/1.fpage'. If you select this '1.fpage', you will get the contents of this file in the left pane:


Step 4: modify the xml by typing in a comment section in the xml edit pane

You can exit the XML content in the right pane. We type in some comments, please note that from the moment you make any modifications, the file becomes 'modified':


Step 5: save the file

You can now save your modified file:


it will contain a modified '1.fpage' with the comments inside.