2

I am trying to read an XPS file that I have inserted into my database using the Filestream attribute. Here is my code thus far.

        RewardsDataContext dx = new RewardsDataContext();
        var img = (from c in dx.RwProductsTests
                   select c).FirstOrDefault();
        byte[] buffer = img.Blob.ToArray();
        MemoryStream ms = new MemoryStream();
        ms.Write(buffer, 0, buffer.Length);
        ms.Position = 0;

        Package package = Package.Open(ms, FileMode.OpenOrCreate, FileAccess.ReadWrite);

        XpsDocument MyDoc = new XpsDocument(package);
        dv1.Document = MyDoc.GetFixedDocumentSequence();
        dx.Dispose();

and I get the following error. XpsDocument URI is null. Use XpsDocument constructor that takes URI parameter.

Andrew
  • 2,519
  • 6
  • 29
  • 46
Jonah Kunz
  • 670
  • 8
  • 19

0 Answers0