4 Answers, 1 is accepted
0
0
Accepted
Hello Asuman,
I can confirm that there is a problem with the printing in this particular case. Fortunately, there is a workaround for this problem. Instead of using RadRichTextBox for printing RadPdfViewer could be used. Attached you can find the solution from the other thread with the required modification.
Regards,
Mihail
Telerik
I can confirm that there is a problem with the printing in this particular case. Fortunately, there is a workaround for this problem. Instead of using RadRichTextBox for printing RadPdfViewer could be used. Attached you can find the solution from the other thread with the required modification.
Regards,
Mihail
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
0
Asuman
Top achievements
Rank 1
answered on 06 Sep 2015, 03:14 PM
Hi Mihail,
Thanks for the solution. It's fixed out my problem for now. However I would be waiting for the solution with radrichtextbo.
Best regards...
0
Accepted
Hi Asuman,
The InvalidOperationException is thrown because the window is closed before the printing had finished. For that reason in the example the window is closed in a Dispatcher. However, when the data to be printed is not minimal the closing still occurs before the printing had finished.
So instead of calling this.Close() in the PrintButton_Click() handler I suggest closing the window when the print operation ends, by adding handler to the RadRichTextBox.PrintCompleted event:
Hope this helps and is suitable for your scenario.
Regards,
Polya
Telerik
The InvalidOperationException is thrown because the window is closed before the printing had finished. For that reason in the example the window is closed in a Dispatcher. However, when the data to be printed is not minimal the closing still occurs before the printing had finished.
So instead of calling this.Close() in the PrintButton_Click() handler I suggest closing the window when the print operation ends, by adding handler to the RadRichTextBox.PrintCompleted event:
public
partial
class
PrintPreview : RadWindow
{
PrintDocument pd;
public
PrintPreview(RadDocument document)
{
InitializeComponent();
this
.RichTextBox.Document = document;
this
.RichTextBox.PrintCompleted += RichTextBox_PrintCompleted;
}
void
RichTextBox_PrintCompleted(
object
sender, PrintCompletedEventArgs e)
{
this
.Close();
}
private
void
PrintButton_Click(
object
sender, RoutedEventArgs e)
{
this
.RichTextBox.Print(
"Test"
, PrintMode.Native);
}
private
void
CancelButton_Click(
object
sender, RoutedEventArgs e)
{
this
.Close();
}
}
Hope this helps and is suitable for your scenario.
Regards,
Polya
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