Share via


XpsStat: A program for gathering statistics information of XPS documents

In the Winhec presentation on XPS document performance optimization, a simple program XpsStat is introduced to analyze XPS documents. 

Given an XPS document, XpsStat generates four or five tables in HTML format:

  • Container Summary Table: information about each type of parts in the document.
  • FixedPage / Remote Resource Dictionary Table: information about each fixed page / remote resource dictionary in the document.
  • Font Resource Table: information about each font resource in the document
  • Image Resource Table: information about each image resource in the document
  • Container Part Table (optional): information about each part in the document

The program has three command line options:

  • /x Generate report in XML format instead of the default HTML format
  • /a Generate the optional Container Part Table
  • /d Extract fonts to external files, unobfuscated.

The program is written using .Net 3.0 XPS related API and some direct parsing of ZIP container. It supports both interleaved and non-interleaved XPS files.

Here is the binary: https://blog.fengyuan.com/XpsStat.exe

Here is what the Container Summary Table the program will generate for XPS Specification 1.0 in XPS format:

Container Summary
Type Count Piece Uncompressed Compressed Compression
Size Percent Average Size Percent Average
fixedpage+xml 453 453 116,521,006 96.74 % 257,220 5,912,474 75.13 % 13,051 94.93 %
package.relationships+xml 434 434 573,558 0.48 % 1,321 164,871 2.09 % 379 71.25 %
properties+xml 1 1 673 0.00 % 673 342 0.00 % 342 49.18 %
fixeddocument+xml 1 1 289,702 0.24 % 289,702 13,756 0.17 % 13,756 95.25 %
opentype 20 20 1,647,572 1.37 % 82,378 576,144 7.32 % 28,807 65.03 %
image 492 492 1,042,993 0.87 % 2,119 992,681 12.61 % 2,017 4.82 %
fixeddocumentsequence+xml 1 1 320 0.00 % 320 160 0.00 % 160 50.00 %
documentstructure+xml 1 1 179,194 0.15 % 179,194 13,154 0.17 % 13,154 92.66 %
/Documents/1/ 1 1 0 0.00 % 0 0 0.00 % 0 NaN %
/[Content_Types].xml 1 1 1,023 0.00 % 1,023 331 0.00 % 331 67.64 %
/Documents/1/_rels/ 1 1 0 0.00 % 0 0 0.00 % 0 NaN %
/Documents/1/Pages/ 1 1 0 0.00 % 0 0 0.00 % 0 NaN %
/Resources/Images/ 1 1 0 0.00 % 0 0 0.00 % 0 NaN %
/Documents/1/Pages/_rels/ 1 1 0 0.00 % 0 0 0.00 % 0 NaN %
/Documents/1/Structure/ 1 1 0 0.00 % 0 0 0.00 % 0 NaN %
ZIP Structure 195,978 0.16 % 195,978 195,978 2.49 % 195,978 0.00 %
Summary 1,410 1,410 120,452,019 100.00 % 85,426 7,869,891 100.00 % 5,581 93.47 %

Comments

  • Anonymous
    May 21, 2007
    Looks like a nice tool, thanks. Why not release the source too so others can enhance it?

  • Anonymous
    May 21, 2007
    This part of the Dissecting XPS series will focus on some XML Paper Specification tools that are available as of today. The success of XPS, vs PDF and others, are really depending on the number of sup...

  • Anonymous
    January 15, 2008
    it is a nice tool.. kindly share ur source code...so that others can enhance... also can any one plz post the code in C/C++ for reading an XPS file

  • Anonymous
    February 02, 2008
    Hi, I'm very interested to the unobfuscation of the font file, so it should be very kind by you to release the source at least of this part. Thanks

  • Anonymous
    February 02, 2008
    Hi, I'm very interested to the unobfuscation of the font file, so it should be very kind by you to release the source at least of this part. Thanks