BT

Your opinion matters! Please fill in the InfoQ Survey!

A Standardized Printing UI for Windows 8

| by Jonathan Allen Follow 247 Followers on Oct 13, 2011. Estimated reading time: 1 minute |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

Windows 8 Metro is bringing with it a lot of changes and printing is no exception. Building upon the charm concept, there is a new API and extendable user interface for printing. This API is available for both XAML and JavaScript-based applications.

Printer support has always been a key selling point for Windows. Its superior support for print drivers is often cited as a key reason why Windows won out over IBM’s OS/2. Yet the user interface aspects of this have long been neglected by Microsoft and each application usually ends up creating its own user interfaces.

The first problem is the standard print dialog exposed by .NET. While it works for basic programs, it offers very little in terms of extensibility. Developers needing to do anything non-standard will end up building their own from scratch. Under Metro application-specific printer options are exposed via the PrintTaskAdvancedOptions class. This has extensibility in the form of text fields and option lists and should work exactly the same in both XAML and JavaScript-based applications.

Another problem is the print preview window, where each program is again responsible for providing its own support for print preview. In Windows 8 Metro solves this by combining the print preview window with the print dialog. Applications that support printing but not print preview will appear to be broken to the user.

The core printing functionality is provided by the Windows.Graphics.Printing namespace. This API is equally usable from both XAML and JavaScript-based applications and in theory results in an identical user experience. With JavaScript-based applications the developer merely needs to register the application for printing and reformat what’s on the screen using CSS using media queries.

With XAML-based applications there is quite a bit more work to do as developers are expected to use XAML to layout the preview and printed pages. Much like WPF and Silverlight printing, one must listen for events raised by an instance of PrintDocument. (This version of the class can be found in the Windows.UI.Xaml.Printing namespace.)

  • AddPage: Indicates that a page is needed for printing
  • Paginate: Triggered when the user changed a setting that may require repaginating the document.
  • GetPreviewPage: Indicates that page is needed for previewing

Because it is based on the Windows.UI.Xaml namespace, printing logic cannot be shared between Metro and desktop-style applications.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT