topical media & game development
professional-xml-26-Listing-26-12.txt / txt
using System.IO;
using System.IO.Packaging;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Xps;
using System.Windows.Xps.Packaging;
namespace XAML_Example
{
public partial class MyDocument : System.Windows.Window
{
public MyDocument()
{
InitializeComponent();
}
void SaveToXPS(object sender, RoutedEventArgs e)
{
DocumentPaginator dp =
((IDocumentPaginatorSource)flowDocumentReader1.Document).DocumentPaginator;
Package pkg = Package.Open("myDocument.xps", FileMode.Create);
XpsDocument xpsdoc = new XpsDocument(pkg);
XpsDocumentWriter xpsWriter =
XpsDocument.CreateXpsDocumentWriter(xpsdoc);
xpsWriter.Write(dp);
xpsdoc.Close();
pkg.Close();
}
}
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.