How to create an XPS document in a WCF service to store and return?

I've got a WCF service as middle tier, and on some occasions I need to create a printable document, store it for future reference in the database, and return it to the client.

My first choice as file format was XPS, so I'd like to create an XPS document in a WCF service, store it, and return it.

Is there an easy way to achieve this, or some other obvious way to solve my problem (storing and returning a printable document in WCF) I've missed?

Answers


Easy? Nothing's easy about XPS.

I'm currently serializing the XPS to a byte array using the XpsSerializerFactory

   using (MemoryStream ms = new MemoryStream())
    {
        var writer = new XpsSerializerFactory().CreateSerializerWriter(ms);
        writer.Write(fds);
        return ms.ToArray();
    }

I've toyed around with just sending the memory stream that backs the document's package across along with the URI of the document, but I've never tested that.


Need Your Help

Short rot13 function - Python

python string encoding

I am searching for a short and cool rot13 function in Python ;-)