documentpage

Serialize WPF component using XamlWriter without default constructor

Ive found out that you can serialize a wpf component, in my example a FixedDocument, using the XamlWriter and a MemoryStream: FixedDocument doc = GetDocument(); MemoryStream stream = new MemoryStream(); XamlWriter.Save(doc, stream); And then to get it back: stream.Seek(0, SeekOrigin.Begin); FixedDocument result = (FixedDocument)XamlR...

Creating WPF components in background thread

Im working on a reporting system, a series of DocumentPage are to be created through a DocumentPaginator. These documents include a number of WPF components that are to be instantiated so the paginator includes the correct things when later sent to the XpsDocumentWriter (which in turn is sent to the actual printer). My problem now is th...

WPF DocumentPaginator and DocumentPage unexpected cropping

I'm trying to print a WPF canvas over multiple pages. I'm perfectly happy with scaling it to fit on the page width, then clipping and translating the canvas for each page; all pretty simple maths. What I don't understand is how I get the dimensions of the printable area, and how to tell the printer where to print to. Whatever I try it ...