fixeddocument

Why am I losing my databinding when printing to an XpsDocument?

Update! Binding works. The issue is that the XpsDocumentWriter doesn't properly write the first page of the first document of a FixedDocumentSequence. This seems to be an issue encountered by lots of people doing this sort of thing (i.e., five developers worldwide). The solution is slightly odd. I include it as an answer. Okay, i...

Blocks to UIElement conversion

Hai is it possible to convert a 'System.Windows.Documents.Block' to 'System.Windows.UIElement' . I need this as i want to add the blocks i created to a fixed document.is there any other way? thanx alot ...

WPF: FixedDocument in Visual Studio 2008 Designer

It's a well-known bug that Visual Studio shows an error when you try to construct a FixedDocument in XAML. For example, the following snippet <DocumentViewer> <FixedDocument> <PageContent> <FixedPage Width="21.0cm" Height="29.7cm"> <TextBlock>Hello World!</TextBlock> </FixedPage> ...

How do I detect the end of a page in a fixed document

How do I detect the end of a page in a fixed document in WPF? I want to be able to print a list of customers, but I'm not sure how to tell when to create a new page. Do I guess? i.e. If i think that 50 customers will fit on the page then I only get the first 50 and then create a new page and display the rest on the second page. Also, w...

ChildControl Height Calculation in Fixed Page Report - WPF

Hi Any idea how to calculate the height of auto generated child controls in fixed-page... When using ActualHeight it give 0.0.... I need to to calculate height of the dynamic content in the fixed page. Thanks and Regards ...

Wpf FixedDocument Canvas Reuse

I'm converting Xaml code to Xps but i can't use a canvas in a merged dictionary as Background of all the pages in a FixedDocument, because it throws an error on the second page. The error say that the Canvas is already in use and i need to disconnect it. I'm triyng to avoid putting a resource for every page because the resulting xps wil...

Viewing Xps document - Compressed part has inconsistent data length

XpsDocument xpsDoc = new XpsDocument(fileName, FileAccess.Read); documentViewer.Document = xpsDoc.GetFixedDocumentSequence(); Second line gives next error: Compressed part has inconsistent data length Why? ...

iTextSharp to generate PDF from WPF FixedDocument

I have a simple WPF app that displays and prints some reports with a FixedDocument. How can generate PDF's from that, with a free and open solution, such as iTextSharp? ...

C# XPS FixedDocument fails to save, width and height must be non-negative

Hi, I am having a problem with a XAML report that needs to be saved to XPS. Whenever the save is called the XPS Writing failed due to, "Height and Width must be non-negative". When I inspect the object, most heights and widths are set to NaN. I am assuming this is ok and is used as an auto value. I have 2 reports built the same way and...

WPF 4 FixedDocument multiple pages

What is the best way to print a complex layout spanning multiple pages in WPF? (for example an invoice layout spanning multiple pages because of many invoice items) I'm guessing one of these methods would do: Dynamically inserting pages in a FixedDocument? how? Convert a FlowDocument to a FixedDocment. How? The solutions found do not...

WPF FlowDocument Page Break/Positioning

Here's the situation. I'm tasked with auto-generating a rather large document consisting of a number of distinct sections of varying height and constant (full-page) width. Each section consists of two distinct sub-sections. Think of them as "header" and "data." The problem, then, is: When only one section fits on a page (because it ha...

How can I use a WPF FlowDocument or FixedDocument to compose a printable page from on screen controls?

I'm attempting to print a number of WPF controls (datagrid, charts etc) that are on screen in my application but which need to be re-arranged and supplemented with other text etc. Using the WPF FlowDocument or FixedDocument seems the obvious way to compose and print documents but I'm struggling to achieve this. I've tried creating a Vi...