Architect or Cobbler?
Good code starts with good design

A little printing difficulty

Thursday, November 23, 2006

I was going to add the Print functionality to my Scribble app next, and the printing side was a piece of old rope - the printing support is excellent. Then I came to do the PrintPreview, and after 2 days I'm still a little stumped - although I have a working solution it feels Kludgy. There are 2 options that I can see (and which I have tested), both of them a little dodgy. The first is to take my InkCanvas and create an XPSDocument, and then encapsulate a DocumentViewer within a Dialog page, as DocumentViewers are WSYISWYG. The second is to use Windows Forms Interop, use the existing WinForms PrintPreviewDialog and use the RenderTargetbitmap class to turn the Vector graphic DrawingVisual into a raster Bitmap, which I can display in the WinForms dialog.

I almost can't believe this oversight, particularly as Microsoft have added PrintPreview as one of the standard ApplicationCommands and made it available via a property.

So I'm probably going to skip printing for a few days and concentrate on the File save/Open dialog.

If anyone can show me how to do a PrintPreview dialog in the meantime, then that would be cool


# posted by James @ 12:23 AM   0 comments Comments: Post a Comment

<< Main blog page
This page is powered by Blogger. Isn't yours?