Convert XAML Flow Document to XPS with Style (multiple page, page size, header, margin)

XPS is a fixed document format in which pages are pre-formated to a fixed page sixe. On the opposite of the spectrum, WPF provides flow document which can be paginated dynamically in XAML viewer. To bridge the two, WPF provides features to convert a flow document to fixed document in XPS format. Actually, you can convert any WPF Visual…

28

Modifying XPS Document: Add Watermark

Windows Platform Foundation has provided easy APIs and solutions for XPS document generation, visualization and printing. But often time, after XPS documents are generated, we would like to modify it in certain way. The scenario I’m trying to demonstrate here is adding a watermark to each page within an XPS document. There are multiple ways…

21

Printing documents to Microsoft XPS Document Writer without user interaction

Now that the XPS storm has been started, people are generating XPS documents from all kinds of sources. Among different ways of XPS generation, the easily way is still through printing to the Microsoft XPS Document Writer (the MXDW printer driver). If you’re printing from your own applications, it’s easy to specify MXDW as the printer…

19

Bought a new computer: HP Media Center PC m7334n with AMD Athlon 64 X2 3800

My desktop computer at home is about five years old, so I thought it’s time to buy myself a new computer. There are two features I’m particularly interested in new computer: media center PC and AMD 64-bit CPU. So I looked around for a Media Center PC with AMD 64-bit CPU. This blog entry will…

16

Windows Graphics Programming: Win32 GDI and DirectDraw (ISBN 0130869856) reprint is here !

Windows Graphics Programming: Win32 GDI and DirectDraw has been out of print for quite sometimes. I tried several times to convince the publisher to reprint it because people are still programming using Win32 API, but they would not do it, quoting that the back-order is not high enough for them to do so. I’ve received numerous…

16

Self introduction

Hello, world of blogging, This is Feng Yuan, a software design engineer with Microsoft. I joined Microsoft three years ago, after working on printer drivers for HP for several years. Since then, I have been working on GDI, GDI+, Avalon and printing. So these will be the focus of this blog. My personal website is…

15

Printing to Microsoft XPS Document Writer without showing File Save Dialog Box

Somehow commenting was not working on my blog, so a reader send me an email on how to print to XPS Document Writer in a server environment without popping up file save dialog box. Printing to file is supported by GDI through the DOCINFO structure passed to StartDoc call. Here is a sample code: void…

14

A Simple XPS Decoder in C++

If you write programs in C#, Windows Presentation Foundation in .Net 3.0 provides quite nice API to write, generate and manipulate XPS documents. You can get the same feature if you work with managed C++ in .Net 3.0. Even if you work with .Net 2.0, you can get the basic ZIP stream decoding/encoding support. But…

10

Creating XPS Documents from Visual, plus an insider look at an XPS Document

In the last article blogs.msdn.com/fyuan/archive/2005/09/11/463708, we discussed how to generate XPS Documents from Win32 applications using the XPS Document Writer. The procedure is very simple, can you simply print whatever contents you have using GDI API. Now let’s try to generate XPS Documents from WPF (Windows Presentation Foundation) using its new API.   As lots…

10

The difference between an amature and professional plumber

An amature plumber makes multiple trips to Home Depot to buy supplies, a professional plumber gets supply from his/her truck. An amature plumber listens to whatever advise other people gives, a professional plumber does not need them. An amature plumber buys much more stuff than what’s needed, a professional plumber knows exactly what’s needed. An…

9