Proof-of-concept Silverlight XPS reader comes to Beta 2 [SimpleSilverlightXpsViewer sample updated for Silverlight 2 Beta 2!]

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of

See you there!

Comments (25)
  1. 14 posts in the last 24 hours! — Silverlight Girl with "Bumble Beegger", Piotr Puszkiewicz

  2. VBandi says:

    Az XPS ugye a Microsoft PDF-e, ha egy mondatban akarjuk megfogalmazni. Itt van egy  Silverlight

  3. samcov says:

    Can we simply use XPS files saved from Word 2007 with this code?

  4. David Anson says:


    I believe that Word 2007 XPS documents do not work by default. I touch on this briefly in the "Introductory Post" I link to above where I first announced the XPS Viewer sample. Basically, the sample supports only the file structure that the XPS Printer Driver outputs because that’s what I had to work with. Any variations on the XPS internal document structure would likely require some changes to the code to support. I don’t recall exactly whether Word 2007 documents are the same, but I think I remember checking and finding them different.

    Hope this helps!

  5. samcov says:

    I tried to create the file using the XPS document writer, but it only outputs a XPS file, and not the additional files you seem to get.

    I’m not sure how you created the printer files.


  6. David Anson says:


    FYI, with the Beta 2 version of the XPS Viewer sample, it is necessary to extract only the font (*.odttf) files and place them alongside the XPS file.

    A good workflow (that includes re-ZIPping the XPS files which is often necessary) goes something like: get content you want to view in an application, print it to the XPS Printer Driver, save that output as file Intro.XPS, rename it to, extract all files to Intro directory with Windows or other ZIP tool, delete, create new file from Intro directory with Windows or other ZIP tool, rename to Intro.XPS, copy all *.odttf files from under Intro to the same location as the new Intro.XPS file, copy Intro.XPS and *.odttf to the Intro.XPS subdirectory that is part of the XPS Viewer Sample (replacing the existing Intro.XPS file and fonts), run XPS Viewer Sample – and you should see your content instead of the default Intro page.

    It’s that "easy"! 🙂

  7. samcov says:

    I thought I posted this, but it hasn’t appeared.

    Anyway, it worked EXACTLY as you outlined it… Thanks!

    It appears that re-zipping is crutial for some reason.

  8. jidizhiguang says:

    It works fine in IIS5.1,but in IIS 6.0 an IIS 7.0 the font does not display, and a downloaderror #4001 occured,Why?

  9. David Anson says:


    I’ll guess that your IIS 6 and 7 configuration is such that *.odttf is not a supported file type for download. You can verify this by trying to download a .odttf file directly from a browser. I expect it to work for your IIS 5.1, but fail from 6 and 7. You should be able to easily fix this by adding *.odttf as a supported file type for download for your IIS 6 and 7 installs.

    Hope this helps!

  10. Delay's Blog says:

    When putting content on the web, it’s important to get that content to the user as quickly as possible.

  11. Tags: Silverlight       Technorati Tags: Silverlight       

  12. Delay's Blog says:

    At the bottom of the post on migrating SimpleSilverlightXpsViewer to Silverlight Beta 2 , I hinted at

  13. Or maybe everything is in a cycle… Develop XPS , awesome fixed format document and print stream format

  14. Laurence Moroney just published a blog post in which he adapted David Anson’s XPS Viewer for Silverlight

  15. hjpavelka says:

    I convertet some pdf files to xps with the XPS Document writer.

    However, If I unzip and re-zip them they stop working! I did not change any content.

    Even the regular viewer can not display them anymore – it displays an exception:

    System.ArgumentException: The document does not contain a valid FixedDocumentSequence.


    MS.Internal.Documents.DigitalSignatureProvider..ctor(Package package)

    what is the issue here?

  16. David Anson says:


    Something about how you’re rezipping the files seems to be going wrong. What I’m guessing is happening is that the file structure is getting changed when you re-zip – possibly the addition of another directory level at the root, or the absence of the subdirectories. You probably want to compare the contents of the files before and after the re-ZIP process to be sure they’re structurally identical. The syntax and default behavior of various ZIP tools is fairly different, so you may need to check the documentation for your particular tool to find out just what settings are needed.

    Hope this helps!

  17. mrtmrcn says:

    i try to open my xps file

    create a folder named : Step1.xps

    i use print out in Step1.xps folder and named :Step1.xps

    extract the fonts ant put it on Step1.xps folder but that’s give me an error :XML_MissingRoot

  18. David Anson says:


    Every time I’ve gotten a problem report like this so far, it has been solved by re-ZIPping the XPS file. Please see the notes in the post and the comments above for details on how to re-ZIP. If that doesn’t work, then something about the XML structure of your file seems to be unusual. The next thing would be to check that the file was generated with the XPS Printer Driver because other techniques are known to produce different file structures that aren’t recognized by the sample application.

    Hope this helps!

  19. Delay's Blog says:

    Since the public release of Microsoft Silverlight 2 , I’ve gotten a few internal and external requests

  20. Fix for Simple XPS Silverlight Viewer for Silverlight 2

  21. ComSpex says:

    Umm… As for VS2008+Silverlight 3, it is not likely to run as per written here…

    The status message is displayed as " (XPS file not recompressed?)"

    I’m tinkering right now but no answer yet…

  22. David Anson says:


    That error usually means something else; I wouldn’t expect to get it from the sample files I include in the source code download. But you may want to read the following post about why this sample doesn’t work on the official Silverlight 2 bits before spending too much time on this:

    Sorry for the trouble!

  23. Ramesh says:

    Recently I am working with XPS viewer for one of the project. I have downloaded your source code but I am getting the below error when I am running this application.

    Exception: (XPS file not recompressed) : System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.

    I am using Silverlight 4.

    Please help me to run this application successfully. This is very urgent for me.

  24. David Anson says:


    It sounds like you're running into the problem I describe in the notes of the original post:…/lighting-up-the-xml-paper-specification-proof-of-concept-xps-reader-for-silverlight.aspx

    As I describe there, a simple un-ZIP and re-ZIP should get things working for you.

    Good luck!

Comments are closed.