0
        byte[] mediaBytes = Convert.FromBase64String("<<strings>>");

        XpsDocument doc;

        ms = new MemoryStream(mediaBytes, 0, mediaBytes.Length);

        Uri DocumentUri = new Uri("pack://document.xps");

        using (Package package = Package.Open(ms, FileMode.Create))
        {
            PackageStore.AddPackage(DocumentUri, package);
            doc = new XpsDocument(package, CompressionOption.Maximum, DocumentUri.AbsoluteUri);
            FixedDocumentSequence fds = doc.GetFixedDocumentSequence();
            documentViewer.Document = fds as IDocumentPaginatorSource;
            PackageStore.RemovePackage(DocumentUri);
            doc.Close();
        }

Can anyone please help me. Its result is an empty document. The mediaBytes is a PDF document.

xscape
  • 3,318
  • 9
  • 45
  • 86

1 Answers1

0

In your statement: Package package = Package.Open(ms, FileMode.Create) You are setting ms as the package destination stream, not a source stream.

psabela
  • 324
  • 1
  • 3
  • 16
  • When you step thru the code, what do you get for fds? Do you get an object or null? – psabela Apr 07 '10 at 13:15
  • See the code at this link: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/48043d53-f552-4869-8d93-8060ba2ab898 – psabela Apr 07 '10 at 14:52