6 Answers, 1 is accepted
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.
Iva
the Telerik team
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
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
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
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.
Iva
the Telerik team