1

This has been asked before. I know.


I can print in WPF Desktop apps. I can print in WinForms apps. I cannot print the contents of even a TextBox in Metro apps. I've tried all the example code, I've taken the advice of everyone I've asked for help, I've implemented their advice. To be honest, printing in Metro apps is absolute BS.

How do you print in Metro apps?

No MSDN documentation please. I am looking for resources to real-world examples where you DON'T add your own formatting or paragraphs or images. I'm looking for resources where you simply print what the user has created (whether that be 1 character, 4 characters or a full document with hundreds of paragraphs, images, etc).

How do we print an RTB in Metro apps? What is the easiest way?

jay_t55
  • 11,362
  • 28
  • 103
  • 174
  • [How to print RichEditBox content (RTF file)](http://social.msdn.microsoft.com/Forums/en-US/22dd533c-cfc7-4b72-9516-bf3bb3bfe2db/how-to-print-richeditbox-content-rtf-file) – Farhan Ghumra Jul 27 '13 at 07:10
  • Thank you for the link. So from what I understand, printing the content ("what you see") of a TextBox _or_ RichEditBox, involves a dirty hack-type of code? – jay_t55 Jul 27 '13 at 07:21
  • For textbox it's still some what easy but for RichEditBox it surely involves hacky stuff. Have you noticed the [OneNote](http://apps.microsoft.com/windows/en-in/app/onenote/f022389f-f3a6-417e-ad23-704fbdf57117) app doesn't provide printing & Metro IE also provide poorest printing ? – Farhan Ghumra Jul 27 '13 at 07:39
  • @Xyroid, I'm so disappointed to learn of these things. They've come so far and made an almost perfect OS in many respects (WinXP and Win7) - now they've taken a thousand steps back with Metro. And we're even missing out on many cool Desktop features that _were_ in Windows 7 (like transparent glass / this can be solved (with a bit of a hack)). Would you mind trying to help me with printing TextBox? My question is over here, I would appreciate it (and there's a +500 bounty going too): http://stackoverflow.com/questions/15595706/how-do-i-print-a-textfile-or-contents-of-a-textbox-in-metro-apps – jay_t55 Jul 27 '13 at 07:53
  • Thank you so much :) I love your blog btw, lots of useful info on it. – jay_t55 Jul 27 '13 at 08:07

1 Answers1

1

According MSDN discussion How to print RichEditBox content (RTF file), it's too much complex to print RichEditBox because if you want to print it you have to manually parse the RTF format & it's literally too much tough task. That's why even OneNote doesn't provide printing & Metro IE also provide poorest printing.

If you want to print text box content, I have created a helper class which simplifies printing text box content. You can add helper class via NuGet. If you want to enhance my existing helper class, fork on GitHub

Farhan Ghumra
  • 15,180
  • 6
  • 50
  • 115