//File:Window.xaml.cs
using System;
using System.IO;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Markup;
using System.Windows.Xps.Packaging;
using System.Xml;
using Microsoft.Win32;
namespace WpfApplication1
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void btnOpenFlowDoc_Click(object sender, RoutedEventArgs e)
{
Stream file = file = File.OpenRead("c:\\b.xps");
TextReader reader = new StreamReader(file);
XmlTextReader xmlReader = new XmlTextReader(reader);
FlowDocument flowDocument = XamlReader.Load(xmlReader) as FlowDocument;
dvDocumentViewer.Document = flowDocument;
}
}
}