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

Html Print does not maintain page separation

6 Answers 47 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 16 Dec 2010, 02:44 PM
Is there a way I can force an Html print to keep page separation?

Right now if I have a document with 3 pages and choose Print -> Html, the Html that is generated does not keep the page breaks.

6 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 17 Dec 2010, 05:22 PM
Side note:  This is for the word example.
0
Iva Toteva
Telerik team
answered on 21 Dec 2010, 04:57 PM
Hi Kevin,

There are generally no pages in HTML and thus you cannot keep your page separation when using HTML print.
The native Silverlight printing does not have that problem, but is much slower and might hang for bigger documents. If, however, you need to print a few pages and keeping the page separation is essential, you can check it out. Silverlight 5 promises to promises to introduce much faster vector-based printing, however in the meanwhile we will continue to seek a better solution for Html printing with more precise page separation.

Best wishes,
Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Mike Shilkov
Top achievements
Rank 1
answered on 05 May 2011, 08:16 AM
Hi.
Maybe some preprocessing of the html would do it? All we need is css attribute page-break-before: always on those paragraphs , which should start at new page.
Is that somehow possible to do that manually in current version?
---
Mike
0
Ivailo Karamanolev
Telerik team
answered on 10 May 2011, 01:19 PM
Hi Kevin,

The HTML we export conforms to the XHTML standard, that means it's valid XML. You can open it with any standard XML library (e.g. XDocument) and perform any manipulations you want. Also, the RadDocument API makes the entire document structure available to you, so technically, there shouldn't be anything stopping you from implementing that functionality.

Kind regards,
Ivailo
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Mike Shilkov
Top achievements
Rank 1
answered on 10 May 2011, 01:26 PM
Hi Ivailo.

Thanks for your answer (I guess you replied to me, not Kevin).
At the moment, I just call 
Viewer.Print(name, PrintMode.Html);
to print my document.

Do you suggest me to change this to some export to HTML + manually print this HTML? Could you provide any code snippet? You can skip adding those attributes to XHTML, but I'd like to know at which point the XHTML is available during print process.

Thanks
---
Mike
0
Iva Toteva
Telerik team
answered on 13 May 2011, 11:49 AM
Hello Mike,

The HTML is not available during the printing. However, you can implement the whole HTML printing quite easily on your end. What we do is to export the document to HTML and use the browser's window.print to print the HTML.
You can process the document to find the paragraphs you wish to insert the page break before through RadDocument and RadRichTextBox's API. Then, export the document to HTML using HtmlFormatProvider and load the output with XDocument. Next, find the paragraphs you want to break before and add the attribute. Invoke the browser's print with the newly created HTML (opened in a new window).
I hope that helps.

Best wishes,
Iva
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
RichTextBox
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Iva Toteva
Telerik team
Mike Shilkov
Top achievements
Rank 1
Ivailo Karamanolev
Telerik team
Share this question
or