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

Add page breaks in HTML to PDF export

2 Answers 171 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Bailey
Top achievements
Rank 1
Bailey asked on 19 Mar 2013, 11:04 PM
I am using the RichTexBox to read HTML and export it as a PDF. However, I have multiple sources of HTML that each need to have their own page within the PDF file. I got the exporting to work but I can't get a page break to be inserted between each body of HTML.
What would be the best way to go about this?

Thanks!

2 Answers, 1 is accepted

Sort by
0
Accepted
Svett
Telerik team
answered on 22 Mar 2013, 02:41 PM
Hi Bailey,

You should use the following code snippet to merge multiple documents and inserting page breaks among them:
private RadDocument MergeDocuments(RadDocument[] documents)
{
    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);
        }
 
        mergedDocument.CaretPosition.MoveToLastPositionInDocument();
        mergedDocument.InsertPageBreak();
    }
 
    return mergedDocument;
}
Kind regards,
Svett
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Bailey
Top achievements
Rank 1
answered on 29 Mar 2013, 03:27 PM
Worked great, thanks Svett!
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Bailey
Top achievements
Rank 1
Answers by
Svett
Telerik team
Bailey
Top achievements
Rank 1
Share this question
or