Html Print does not maintain page separation

7 posts, 0 answers
  1. Kevin
    Kevin avatar
    31 posts
    Member since:
    Jan 2009

    Posted 16 Dec 2010 Link to this post

    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.
  2. Kevin
    Kevin avatar
    31 posts
    Member since:
    Jan 2009

    Posted 17 Dec 2010 Link to this post

    Side note:  This is for the word example.
  3. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 21 Dec 2010 Link to this post

    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
  4. Mike Shilkov
    Mike Shilkov avatar
    33 posts
    Member since:
    Apr 2010

    Posted 05 May 2011 Link to this post

    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
  5. Ivailo Karamanolev
    Admin
    Ivailo Karamanolev avatar
    276 posts

    Posted 10 May 2011 Link to this post

    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
  6. Mike Shilkov
    Mike Shilkov avatar
    33 posts
    Member since:
    Apr 2010

    Posted 10 May 2011 Link to this post

    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
  7. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 13 May 2011 Link to this post

    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
Back to Top