WPF and XPS: Empty Document Viewer

Posted by xscape on Stack Overflow See other posts from Stack Overflow or by xscape
Published on 2010-04-06T07:45:41Z Indexed on 2010/04/06 7:53 UTC
Read the original article Hit count: 501

Filed under:
|
|
        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.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about xps