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();
        }

谁能帮帮我吗。结果是一个空文档。mediaBytes 是一个 PDF 文档。

4

1 回答 1

0

在您的声明中: Package package = Package.Open(ms, FileMode.Create) 您将 ms 设置为包目标流,而不是源流。

于 2010-04-06T12:14:17.070 回答