Return XPS document from a web service

Hopefully this is a simple thing, but how can I return a XPS or FixedDocument via a Web Service Even something as simple as how to turn a XPS document to a byte() and the conversion from byte() to XPS Thanks.

Steve



Answer this question

Return XPS document from a web service

  • Forscius

    Hi Sapaplanus,

    An XPS document is simply a ZIP file. Your best bet is to treat it as binary data, and send it across the wire. You can retrieve it the same way, and once you have the file, then open it up as an XPS Document.

    If what you want to do is keep everything in memory, then depending on your scenario it may not be possible. The architecture of an XPS document relies on links from one part in the zip to another. If you're creating content dynamically, you will generally need to serialize it to a file in order to generate these links - the XPS serialization APIs will do all the work for you. You can then re-open the new XPS file and treat it as a binary stream (ie: BinaryStreamReader).

    Hope that helps! If not feel free to re-state your scenario and we'll give it another go. You can also reach us at xpsinfo@microsoft.com

    -.dennis


  • Return XPS document from a web service