Opening XPS document in .Net causes a memory leak

Well, I found it. It IS a bug in the framework and to work around it you add a call to UpdateLayout. Using statement can be changed to the following to provide a fix; Using XPSItem As New Windows.Xps.Packaging.XpsDocument(PathToTestXps, System.IO.FileAccess.Read) Dim FixedDocSequence As Windows.Documents.FixedDocumentSequence Dim DocPager As Windows.Documents.DocumentPaginator FixedDocSequence = XPSItem.GetFixedDocumentSequence DocPager = FixedDocSequence.DocumentPaginator DocPager.ComputePageCount() … Read more

Convert WPF (XAML) Control to XPS Document

Actually after messing around with heaps of different samples, all of which are incredibly convoluted and require the use of Document Writers, Containers, Print Queues and Print Tickets, I found Eric Sinks article about Printing in WPF The simplified code is a mere 10 lines long public void CreateMyWPFControlReport(MyWPFControlDataSource usefulData) { //Set up the WPF … Read more