Mega Code Archive

 
Categories / C# / WPF
 

Xps file viewer

<Window x:Class="Documents.ViewXPS"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="ViewXps" Height="300" Width="300" Loaded="window_Loaded">   <DocumentViewer Name="docViewer">     </DocumentViewer> </Window> //File:Window.xaml.cs using System; using System.Collections.Generic; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Windows.Xps.Packaging; using System.IO; namespace Documents {     public partial class ViewXPS : System.Windows.Window     {         public ViewXPS()         {             InitializeComponent();         }         private void window_Loaded(object sender, RoutedEventArgs e)         {             XpsDocument doc = new XpsDocument("a.xps", FileAccess.Read);             docViewer.Document = doc.GetFixedDocumentSequence();             doc.Close();         }     } }