1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / "Print Version" of each page?

"Print Version" of each page?

12 posts, 0 answered
  1. TSW
    TSW avatar
    8 posts
    Registered:
    25 Nov 2007
    03 Jun 2008
    Link to this post
    Is there a way to automatically create a "Print" version of each page? i.e. Place a "PRINT" bbutton in a template which automatically prints the page content using a different template?
  2. Dave
    Dave avatar
    76 posts
    Registered:
    10 Mar 2008
    03 Jun 2008
    Link to this post
    Personally, I would add the "Print" button onto your template(s), and use the window.print() javascript method to trigger the print.  Then I would use CSS (media=print) to restyle the layout to be suitable for printing (removing certain sections of the page, etc.).  I think this is a pretty standard practice.

    As for using a completely separate template for printing, I'm sure there's a way but I'm not sure how complicated it would be.
  3. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    05 Jun 2008
    Link to this post
    Hello Adrian,

    Dave is right. This is the classical approach, and suggestion with changing dynamically the templates is not so hard to achieve. Please follow the forum thread Change Theme via Drop Down as it covers the problem for changing the templates dynamically.

    Dave, thank you for participating in the discussion :)

    Regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. Daniel
    Daniel avatar
    1 posts
    Registered:
    14 Nov 2008
    05 Feb 2009
    Link to this post
    Hi Georgi,

    I have a somewhat related question.  We are currently building a site in SiteFinity and are seeing issues when attempting to print pages (File -> Print from the browsers).

    For example, we have a page with some images, text, and a chart.  Here is the output we are seeing while printing:

    IE 6.x: we get all the text with no images

    Firefox 3: we get all of the images, no text, and only the chart prints

    IE 7: mostly blank page

    Would you know of any reason why this would happen and how we can control it a little better?  Creating a "Print Version" of each page is not an option for us as our site has well over 200 pages.

    Hoping you could provide some assistance.

    Thanks,
    Daniel
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    06 Feb 2009
    Link to this post
    Hi Daniel,

    It seems that the different browsers interpret your html contents in different way. This is out of the Sitefinity scope, unfortunately. That is why, we are suggesting to create a different theme. For example, you will have a printer friendly version (accessible through a link), which is specially prepared with minimum elements.

    Greetings,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Jackson
    Jackson avatar
    51 posts
    Registered:
    23 May 2008
    06 Feb 2009
    Link to this post
    Here's how I handled this pretty easily.

    I have a template that is print friendly and it is on its own page.  The page is just a child page of the article details page.

    Then, I have an articles feature control which is added to each article template.  Inside of this control I have a print friendly link.

    On the Page_Load of this control I have this code.

    lnkPrint.NavigateUrl = Request.Url.ToString().Replace(

    "/article/", "/article/print/");

     

    This way I set the NavigateUrl property of this hyperlink to be the print friendly page.

    You can see an example here

    http://www.okc.biz/article/02-04-2009/Urban_expert_offers_advice_to_grow_Oklahoma_City.aspx

    Thanks,
    Chris Morrow

  7. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    09 Feb 2009
    Link to this post
    Hello Chris Morrow,

    Thank you for providing your solution. I had the same approach in my mind.

    Regards,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Chanan Zass
    Chanan Zass avatar
    123 posts
    Registered:
    21 Aug 2012
    13 Feb 2009
    Link to this post
    Preparing a duplicate version of each page is certainly work-intensive, and is out of the question on sites with hundreds of pages in each language.
    If we were to just get the main page content (ignoring all the fixed template elements), where would we find it in the sitefinity database? I could hunt for it myself, but if anyone knows, you'd be saving me an hour or two and might win a Venetian carnival mask.

    Thanks.
  9. Chanan Zass
    Chanan Zass avatar
    123 posts
    Registered:
    21 Aug 2012
    13 Feb 2009
    Link to this post
    Actually, I think a thing to try would be editing the site templates and turning all divs to runat=server, then turning them visible or not depending on a variable that either exists or not in the URL query string (&print=1, for example).
    This way one should be able to turn off the head banner, left column, etc.
    Hope this works. Will be trying it tomorrow.

  10. Chanan Zass
    Chanan Zass avatar
    123 posts
    Registered:
    21 Aug 2012
    14 Feb 2009
    Link to this post
    I've tried this and it works.
    This is doable with simple templates. Some of ours are a bit complex and would require a lot of tweaking.
    We would probably opt for a use of a module we have ready in another programming language, which filters through a page before flushing it on the screen.

    Looking forward for some Sitefinity module to do same.
  11. Chanan Zass
    Chanan Zass avatar
    123 posts
    Registered:
    21 Aug 2012
    24 Feb 2009
    Link to this post
    This is what we ended up doing for a "print this page" link, following Scott Mitchell's article here: http://www.4guysfromrolla.com/webtech/061103-1.shtml.

    We've created a style sheet for printing, 2ColumnPrintStyle.css:
    --------------------------------------
    body {
    FONT-SIZE: 10pt;
    COLOR: black;
    FONT-FAMILY: Arial;
    BACKGROUND-COLOR: white;
    }
    #left {
    display: none;
    }
    #logo {
    display: none;
    }
    #topSearchForm {
    display: none;
    }
    #fontSze {
    display: none;
    }
    #menuholder {
    display: none;
    }
    #footer {
    display: none;
    }
    .signature {
    display: none;
    }
    a:after {
    content:' [' attr(href) '] ';
    }

    [...]
    -----------------------------------------------------------------
    This file can be saved anywhere, but not within the folder of your theme, under App_Themes, otherwise it would be loaded automatically with each page. It should be loaded only when printings.

    Then inserted this link in the head section of the 2 column master page:
    ------------------------------------------------------------------
    <head runat="server">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="content-language" content="en" />
    <link media="print" rel="stylesheet" type="text/css" href="/2ColumnPrintStyle.css" />
    </head>
    ------------------------------------------------------------------

    Link for printing:
    ------------------------------------------------------------------
    <a href="javascript:window.print();"><img src="/App_Themes/MM/img/printer_icon_1.gif" /></a><br />
    ------------------------------------------------------------------

    Hope this helps.

  12. Bob
    Bob avatar
    330 posts
    Registered:
    30 Dec 2016
    24 Feb 2009
    Link to this post
    Hi Chanan Zass,

    This is the most appropriate way to handle printing. I was going to suggest the same.
    Here is pretty nice video explaining how to handle CSS media types:

    http://css-tricks.com/video-screencasts/52-building-a-print-stylesheet/

    Regards,
    Bob
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
12 posts, 0 answered