Friday, February 03, 2012 9:26 AM
In continuation of the following discussions http://social.msdn.microsoft.com/forums/en-US/windowsxps/thread/aa69f544-a391-4d73-8efc-c4cf5f7475a2, http://social.msdn.microsoft.com/Forums/en-US/windowsxps/thread/200243a0-27dc-4feb-979d-33e6b4b22b5c/ , http://social.msdn.microsoft.com/forums/en-US/windowsxps/thread/afec6da7-9e4e-4028-a73c-205999a1eb5a/ and http://social.msdn.microsoft.com/Forums/en-US/windowsxps/thread/958bd801-31dd-40fd-ab44-1a4db545789b
this is one possible *free* method of editing XPS documents.
What you need:
2. Text editor (notepad++ recommended)
The XPS file is basically a zip file. Once can rename the .xps file to .zip and unzip it. XPS uses the ZIP 1.0 specification. While most zip utilities are able to unzip the xps file renamed to .zip, they are not able to put it back together as a ZIP 1.0 file. 7-zip is able to do this, however please follow the specific instructions below.
Open the 7-zip file manager and browse to the folder in which the xps file is present. Right click the xps file and select "Open Inside". This should let you browse the xps file as a zip archive.
You should see a folder called Documents. Inside there will be a folder called 1. Inside 1, you will see a folder called Pages. Inside Pages you will find files called 1.fpage, 2.fpage etc... these are the actual files which contain the data for each page displayed by the xps viewer.
For more info on the XPS structure see here http://www.codeproject.com/Articles/25376/Introduction-to-XPS-Part-1-of-n-of-too-many
If you want to edit page 1 then extract 1.fpage and open it in a text editor. You should see something like this
<Glyphs Fill="#ff000000" FontUri="/Documents/1/Resources/Fonts/99D420B0-4227-4464-94B5-A9D834564E13.odttf" FontRenderingEmSize="13.2548" StyleSimulations="None" OriginX="49.12" OriginY="111.04" Indices="41,62;85,38;82,62;80;29" UnicodeString="From:" />
The first reference to the ODTTF file is the font to be used to display the character. An ODTTF file contains only the fonts of characters present in the document. In case you want to add a character not present in the document then create your own ODTTF file. More on this later. The indices are present in a set of pairs. The first number is the index number of the character in the font table and the second number is the advance width. The Origins and Fontrendering size are selfexplanatory. One can either get delete all the indices data and just edit the unicode string or one can recreate the indices data as well.
Once you have edited the data to make the desired changes save the 1.fpage and drag and drop it into the 7-zip file manager. It should ask whether to replace, say yes. Open the file in XPS viewer and one can see the changes.
Tip: The Indices number pairs are given preference over the Unicode String. If the Indices data are not present then the Unicode string is used. Ensure that the number of characters as given by the indices and the unicode string match otherwise xps viewer throws an error.
To create and odttf file just create a word document with all the characters you need i.e., a-z,A-Z,0-9 and special characters and print it to the xps printer. Then extract the odttf file and dump it into the xps one is editing.
For extracting fonts from odttf files see here http://khason.net/blog/converting-fixeddocument-xpsdocument-too-to-flowdocument/ or here http://blogs.microsoft.co.il/blogs/tamir/archive/2008/04/17/converting-fixeddocument-xpsdocument-too-to-flowdocument.aspx
A simple script should be able to convert an odttf to a normal ttf, but it is forbidden by the licensing terms
For detailed info on Glyphs see http://social.msdn.microsoft.com/Forums/en-US/windowsxps/thread/d38afcc9-f939-4874-a534-36c47cf21a84/,http://msdn.microsoft.com/en-us/library/bb979862%28v=vs.95%29.aspx and http://msdn.microsoft.com/en-us/library/ms748985.aspx
So thats it about how to edit an xps document. The above steps are useful for small changes. For bigger changes it is better to edit the source document or use one of the paid xps editors.
Friday, February 03, 2012 6:08 PMModerator
Thank you for your post.
Bryan S. Burgin Senior Escalation Engineer Microsoft Protocol Open Specifications Team
Saturday, April 27, 2013 4:06 AM
.XPS format files - Microsoft's PDF alternative (*NOT*)
Only Microsoft could product an open document format that can't be opened by any word processing software! Even MS Word (Document contains errors!) can't open these files although they open just fine in the XPS Document Viewer!
How on earth are you supposed to be able to open and edit the .xps files?
At least with PDF files there are a number of programs out there that can open, edit and save PDF files.
.xps is a joke~1
Monday, April 29, 2013 6:47 PMModerator
The purpose of this forum is to support the Open Specifications documentation. You can read about the Microsoft Open Specifications program from http://www.microsoft.com/openspecifications/en/us/default.aspx
The library of Open Specification documents can be accessed from http://msdn.microsoft.com/en-us/library/dd208104(PROT.10).aspx. If you have a specific question regarding the protocol specification please post it under a separate thread. Your question may be more applicable to this forum http://social.msdn.microsoft.com/Forums/en-US/windowsxps/threads
There’s also an api you can refer to, http://msdn.microsoft.com/en-us/library/ms749165.aspx, and you can edit them with VS, http://blogs.msdn.com/b/adrianford/archive/2008/07/03/visual-studio-and-xps-files.aspx
Microsoft Windows Open Specifications
- Edited by S NadendlaMicrosoft Employee, Moderator Monday, April 29, 2013 6:50 PM