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

Printing RadRichText after merging RadDocuments.. Print method hangs on and does not print.

1 Answer 49 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
N
Top achievements
Rank 1
N asked on 17 May 2012, 04:40 PM

key: WPF, RadRichTextBox, RadDocument

I did the following steps to print merged RadDocument but it does not print and calling Print method hangs on forever. I had to kill the process.  Printing 1 Document works fine but same issue happens when I try to print 2 merged documents.

1. I am merging a list of RadDocuments  in to one RadDocument using methods answered in this forum.       
2. Then setting RadRichTextBox’s  document to the above created merged RadDocument.
3. Then printing using RadRichTextBox’s print method. radRichTextBox.Print("richtextbox", PrintMode.Native)

FYI, for Part 1) I did try this:
    foreach(var document in radDocuments)
    {
        mergedDocument.CaretPosition.MoveToLastPositionInDocument();

        mergedDocument.InsertInline(new Telerik.Windows.Documents.Model.Span(FormattingSymbolLayoutBox.PAGE_BREAK));

        mergedDocument.InsertFragment(new DocumentFragment(document));

}

and also  this:
 RadDocument mergedDocument = new RadDocument();
 foreach (RadDocument document in documents)
 {
     foreach (Section section in document.Sections)     {
         Section copySection = section.CreateDeepCopy() as Section;
         document.Sections.Remove(section);
         mergedDocument.Sections.Add(copySection);
     }
 }

Am i merging RadDocuments correctly? What could be the issue?
If this is a known Issue, then whats the best way to Merge and Print RadDocuments?

By the way : Document 1 had 7 pages and Document had 4 pages with 4 images total. It seems that as soon as I merge it does not print.

Thanks

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 21 May 2012, 04:59 PM
Hi,

I tried merging and printing documents with the latest version of the controls - 2012 Q1 SP1 (2012.1.326) as done in the first code-block from your snippet:
foreach(var document in radDocuments)
{
    mergedDocument.CaretPosition.MoveToLastPositionInDocument();
    mergedDocument.InsertInline(new Telerik.Windows.Documents.Model.Span(FormattingSymbolLayoutBox.PAGE_BREAK));
    mergedDocument.InsertFragment(new DocumentFragment(document));
}

The documents were successfully merged and printed.

Please find attached the demo I used for testing. If you manage to reproduce the issue with this project, we would appreciate it if you could send us the documents, so that we can debug the issue and track the cause of the issue. In case everything works correctly with this sample, but you are not able to resolve the issue in your original application, please attach a project of yours, so that we can assist you further.

Kind regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
N
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or