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

Print RTF from Windows Service

1 Answer 140 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 18 Sep 2015, 07:24 PM

Hello

I am using the RichTextEditor control to allow users to create a document (which may include embedded images). The RTF text is then stored in a database, and a Windows Service is supposed to print the document at a later date.The Windows Service does not allow any dialog or form to be shown, so neither a normal print dialog, nor converting to PDF and printing with a PDF Viewer can be used to print.

My current approach has been to convert the RTF to a PDF with RtfFormatProvider and PdfFormatProvider, save it to a file, and print it using the Print verb. However, no matter what options are given to the Print process, it still tries to start the Adobe PDF Viewer to print.

Does Telerik offer a way to print RTF documents without any UI? Or perhaps stock WinForms has a way that I am overlooking. 

I am using version Q3 2014 (2014.3.1104)

Thank you for any assistance.

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 21 Sep 2015, 11:35 AM
Hello Todd,

We do not offer any means to print an RTF document without UI - RadRichTextBox has a Print method overload which allows to do not show the settings dialog, but still a Printing dialog n that counts the pages sent to the printer.

A quick search on the matter shows that there is a way to print in WinForms without UI, but it is rather not recommended and with a lot of drawbacks. Here is an article you might find useful: http://blogs.msdn.com/b/dsui_team/archive/2013/06/24/printing-from-a-windows-service.aspx. And one more with some comments: http://stackoverflow.com/questions/7990/printing-from-a-net-service.

I hope that you find this information useful.

Regards,
Stefan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
RichTextEditor
Asked by
Todd
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or