How do I create an XPS document in WCF Service to store and retrieve?

I have a WCF service as a middle tier and in some cases I need to create a printable document, save it for future reference in the database and return it to the client.

My first choice as the file format is XPS, so I would like to create an XPS document in WCF service, save it and check it back.

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

0


source to share


1 answer


Easy? XPS couldn't be easier.

I am currently serializing XPS to byte array using XpsSerializerFactory



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

      

I played around by just sending a memory stream that supports the batch of documents, along with the document URI, but I've never tested this.

+1


source







All Articles