Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Is there any way I can compare two xps files using c sharp. I am trying to compare the files using binary comparison. But every time the output is different. Everytime the file is getting generated, there is a difference in the number of bytes. Please suggest.
Posted
Updated 6-Feb-13 3:57am
v2
Comments
Marius Bancila 6-Feb-13 9:57am    
This forum is for C++, not C#.

1 solution

XPS files are in fact simple ZIP archives with bunch of XML files and embedded resources.
Try to unpack them and compare files under /Documents/1/ directory.
The main problem of this approach is that each time you re-save the same document, different Guids are used for same fonts!
 
Share this answer
 
Comments
sonia$cool 7-Feb-13 0:44am    
Yes.. different GUIDs get generated each time. But my xps files save a PNG image which is under .../Resources/Images. If I succeed in unzipping the xps file, I can compare the PNG files. But the problem is with unzipping the xps files. I tried using GZipStream class under System.IO.Compression but in vain. I am getting a runtime error like 'The magic number in GZip header is not correct. Make sure you are passing in a GZip stream.' Any help with this..
Matej Hlatky 7-Feb-13 4:55am    
GZip is not the same as ZIP!
GZip is for compressing single byte streams, ZIP is for files (with file names and folder structure).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900