Printing landscape flow documents

Jul 5, 2013 at 4:25 PM
I have a couple of reports which I need to print (and save as XPS) in landscape orientation. The reports reference a style specifying a width of 1056 dip (device independent pixels) and height of 816 dip. The framework performs the screen layout exactly as one would expect. When we get to saving as XPS or printing, however, the output is not landscape.

For XPS, I have explicitly specified 1056 and 816 in the SaveAsXps method. The content is correctly formatted as landscape (i.e. the paginator is doing it's job) but the actual "page" is still in the portrait orientation so the report data disappears off the right side.

A similar story for printing the document. Here, however, the problem is that there is no way to pass size or orientation info to the print dialog. Looking in the framework PrintHelper.Print code, size info from the document is not passed to the PrintDialog and only the PageMediaSize, returned from the PrintDialog, is passed to the DocumentPaginatorEx to indicate the page size in the PrintDocument method.

Has anyone worked with landscape flow documents with the Code framework? Any suggestions are welcome.
Coordinator
Jul 8, 2013 at 12:37 AM
This is actually a very good question. Which is a different way of say it is tough to answer :-).

We haven't done any specific work for landscape printing, although we probably should. I have added it to the list of items we need to look at. Maybe we can even get something in for the next build.

There are a few different issues here. For XPS export, if I remember right, WPF only supports that by manually applying a 90 degree rotate transformation to the content. We could probably abstract that away and make it much simpler by just providing an orientation parameter. We could also pass a similar parameter to the print feature, in which case we could just set that on the print ticket. Maybe we could also expose a delegate one could pass in that could then be used to get full access to the print objects and set any properties on those objects. Would you find that helpful?

For the page size when printing: What would you want to happen there exactly? When printing, the size is pretty much dictated by the printer, isn't it?


Markus
Jul 9, 2013 at 5:08 AM
Hi Markus,

There is really no inconvenience configuring the print dialog to handle specific/non-standard requirements. The reason I posted is that I have learned that using the built-in framework functionality almost always works out better for me in the long run and so I tend to put extra effort into understanding the FW way before trying other options.

For the time being I've just setup the print dialog parameters myself then I invoke the printDialog.PrintDocument method to generate the report. I now have a problem in that the paginator is creating two columns on the landscape oriented page, both columns are cut off on the right (i.e. the colums are not wide enough to contain the full report detail line). What I really need is one full width column. The page header and page footer extend across the full width of the page, as they should. I haven't yet determined whether I've misconfigured something somewhere or not. I am not sure which properties would affect how or when content is truncated and/or wrapped to a new column.

Letter or legal in portrait or landscape covers 99.9% of business users' needs. My experience is that the user dictates the paper size and orientation of reports based on his or her requirements. Paper size and orientation is all I would need a framework to handle. Even then, it is really the paginator that does the heavy lifting so, no, I wouldn't add too much more, in terms of printing options, into the framework.
Coordinator
Jul 12, 2013 at 12:42 AM
OK, I will take a look at this.


Markus