Previous month:
April 2008
Next month:
June 2008

May 2008

XPS Printing

I've stored an invoice from the Internet as XPS for later printing. Now printing with the XPSViewer.exe fails with an exception because it demands permission for UnmanagedCode.
Instead trying to find a fix for the application I've written a small program to print XPS:

PrintDialog dlg = new PrintDialog();
if (dlg.ShowDialog() == true)
   XpsDocument doc = new XpsDocument(fileName, System.IO.FileAccess.Read);
   dlg.PrintDocument(doc.GetFixedDocumentSequence().DocumentPaginator, "Test");

It's really easy to work with XPS. XpsDocument is part of .NET 3.5 in the assembly ReachFramework, namespace System.Windows.Xps.Packaging.