Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Render (Print) WPF visual to GDI+ Graphics object

 
 
Old 07-05-2007   #1 (permalink)
swythan


 
 

Render (Print) WPF visual to GDI+ Graphics object

Hi,

I'm researching how we will go about implementing printed/exported
reports for a possible new product.

We're likely to have some custom data presentation that uses WPF for
rendering, but the reporting frameworks I've been looking at use GDI+
for printing. We will want to render our WPF content into the middle
of their GDI+ graphics context, at as full fidelity as possible.

I guess we could always render the WPF content into a bitmap (at the
printer's resolution) and then render that into the GDI+ context, but
that seems like it's likely to use a lot of memory. Also I would
imagine we'll want to export the reports as PDF, etc as well, so
putting huge bitmaps in the middle could massively increase the file
size.

Any ideas?

James

P.S. Alternatively, does anyone know any reporting frameworks that use
the new XPS APIs for printing?


My System SpecsSystem Spec
Old 07-07-2007   #2 (permalink)
Lloyd Dupont


 
 

Re: Render (Print) WPF visual to GDI+ Graphics object

No ideas, but that's a good question hey!

On a second thought I have an idea..
based on no experience or knowledge of the API, just an idea to explore....

perhaps you could do the GDI+ printing to an XPS document, then open the XPS
document and render WPF content on it.

Then send this XPS document to the printer.....


My System SpecsSystem Spec
Old 07-09-2007   #3 (permalink)
swythan


 
 

Re: Render (Print) WPF visual to GDI+ Graphics object

On Jul 7, 1:13 pm, "Lloyd Dupont" <net.galador@ld> wrote:
> perhaps you could do the GDI+ printing to an XPS document, then open the XPS
> document and render WPF content on it.
>
> Then send this XPS document to the printer.....


Ouch. Nice hack! ;-)

Unfortunately, it would rather detract from the usefulness of using a
reporting framework (data-binding, export to HTML/PDF/Excel, etc), as
I'd have to go back through the document inserting content myself.

That makes me think about the export to Word/Excel situation,
actually. Has anyone found a way to render WPF content into a
metafile, or some other vector-based format that Office supports? I
guess that's sort of equivalent to my first question.

James


My System SpecsSystem Spec
Old 07-11-2007   #4 (permalink)
Matthias Roth


 
 

Re: Render (Print) WPF visual to GDI+ Graphics object

I have the same problem, but no solution so far.
I have found the class CGDIRenderTarget
(Microsoft.Internal.GDIExporter.CGDIRenderTarget), which would do the
job, but it is not accessible.

Matthias
My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
HP7210 doesn't print graphics Vista print fax & scan
printer won't print graphics Vista print fax & scan
Adding canonical aliases for Compare-Object, Measure-Object, New-Object PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46