This is a migrated thread and some comments may be shown as answers.

[Solved] Printing crashes when using PrintMode.Html

6 Answers 167 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Grayson Mitchell
Top achievements
Rank 1
Grayson Mitchell asked on 19 Feb 2011, 03:53 AM
When I use the command this.radRichTextBox1.Print("doc",PrintMode.Silverlight); printing works fine (but it is sending a bitmap so is extremely slow, and unacceptable)  

But when I use the command this.radRichTextBox1.Print("doc",PrintMode.Html) I get the error: There is no DocumentFormatProvider which supports html (I have already got a reference to Telerik.Windows.Documents.FormatProviders.Html)

How can I get Html printing to work?

P.S. The documentation on this control is very limited.  I actually hired a contractor to do this work, but have found that
A\ He was using the silverlight print command within the xaml which actually prints the entire page rather than the document.
B\ his xaml containing the control is very long and complex, and I suspect having some experience with the ASP RadEditor that you would not need to hand craft every single menu option.

But all of this is understandable given that there is hardly any examples of how to do printing out there!

Thanks.

6 Answers, 1 is accepted

Sort by
0
Grayson Mitchell
Top achievements
Rank 1
answered on 19 Feb 2011, 04:17 AM
I downloaded and installed the latest version, and now the Html print option seems to work!

1\ Is there a way that the page layout on the RichTextBox will match the print job? 
2\ Is there a way to stop the header and footer printing?

Cheers
0
Ivailo Karamanolev
Telerik team
answered on 22 Feb 2011, 03:46 PM
Hi Grayson Mitchell,

When using HTML printing, all RadRichTextBox does is export the document to HTML, write it on a blank page and use the JavaScript API to make the browser print it. Page layout and header/footer placement are therefore performed by the browser. Setting up the header and footer is thus browser-specific and the application has no control over it. The same applies to page layout, as it is controlled via the print dialog (OS handled).
The best way currently supported to print documents while exactly preserve paging and headers/footers is to use PDF exporting and let the user print the generated PDF.
Let us know if you require any further assistance.

Best wishes,
Ivailo
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Grayson Mitchell
Top achievements
Rank 1
answered on 22 Feb 2011, 10:50 PM
Yea, thanks.

I will look forward to Silverlight 5 to solve these issues with printing, as there is no complete solution at this time.

1\ Any Html solution does not print the document in a satisfactory way (i.e. page layout, page breaks etc).
2\ I could create a PDF on the server, but then my users cant "tweak" the document to meet there requirements.
3\ Silverlight printing is fairly unbearable when it comes to speed.

Thanks for your help
0
Ivailo Karamanolev
Telerik team
answered on 23 Feb 2011, 10:40 AM
Hello Grayson Mitchell,

As we support PDF exporting on the client side too, you can let the users edit the document, then save it and print it as they like. The Adobe Acrobat/Reader printing is feature rich, so your users should be able to achieve anything they want. Also, the PDF format is almost ubiquitous currently, so you shouldn't meet any portability issues.
In Silverlight 5, we hope, printing will be properly supported and we're ready to provide a solution to utilize it. However, until then, we'll be happy to hear the reason PDF exporting on the client doesn't suit your needs.

Kind regards,
Ivailo
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Grayson Mitchell
Top achievements
Rank 1
answered on 23 Feb 2011, 08:54 PM
OK, I think what I am currently doing is the best option available to me at the moment (Using your RichTextBox control & the Silverlight Print option).  Here is what I am trying to achieve

1\ Have a template document that is editable by a admin user, that saves to the server (has mail merge fields within it) - I don't think there are any issues here.

2\ When the user clicks print in the silverlight application the document opens (allows editing, local save, and print - but no server saving) filling in the mail merge fields based on the page/view they are on.  In a perfect world I would expect they would just look at this document, and then click print.

When I was thinking about how to achieve this with a pdf, it sounded like my only option was to generate the pdf with the mail merge fields populated on the server (I found some open source tools to do this), then stream that to the browser (somehow).  From what I read it did not seem possible to do this on the client.  - I parked this in the too hard basket, as as usual I have time constraints ;)  

If you think there is a better option, I would be keen to hear it.
(With the current Silverlight option, I would likley update as soon as a beta print option was available)

Thanks
Grayson
0
Boby
Telerik team
answered on 01 Mar 2011, 12:57 PM
Hello Grayson Mitchell,

Unfortunately currently we do not support mail merge fields functionality out of the box. This is a feature we are currently working on and hopefully will be available in Q1 or shortly after it. However this functionality can be simulated using some custom coding against RadDocument API. The rest of the scenario seems possible with RadRichTextBox. Please note that RadRichTextBox offers standard Silverlight approach to manage the documents, through API and databinding and it does not have any built-in automated way to save documents in a database or server.
You can open a support ticket if you need further assistance with this scenario.

All the best,
Boby
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
RichTextBox
Asked by
Grayson Mitchell
Top achievements
Rank 1
Answers by
Grayson Mitchell
Top achievements
Rank 1
Ivailo Karamanolev
Telerik team
Boby
Telerik team
Share this question
or