Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How challenging is it to add these two functions to all SharePoint site pages?

  • Have a printer icon that allows user to print the content of the page
  • Have a PDF icon that lets the user export the page as a PDF document

Are there any 3rd party solutions for this?

share|improve this question
add comment

6 Answers 6

up vote 11 down vote accepted

We usually use print style sheets (<link rel="stylesheet" href="print.css" type="text/css" media="print" />) to do this.

Check this guide:
http://www.webcredible.co.uk/user-friendly-resources/css/print-stylesheet.shtml

I know Muhimbi has a good third party PDF generator, but I havent tried it.

share|improve this answer
    
Thanks, Anders. In general, is it difficult to print lists in SharePoint 2010, with/without a print CSS? –  Alex C Sep 12 '11 at 9:15
1  
I can confirm that the Muhimbi PDF Converter for SharePoint is brilliant :-) See this link for HTML to PDF conversion: blog.muhimbi.com/2010/09/…. You can also trigger the process from your own links and even SharePoint Designer and Nintex workflows. –  Muhimbi Sep 12 '11 at 10:09
    
Thanks, Muhimbi. Can the PDF conversion tool appear as an icon on the page itself instead in a menu? –  Alex C Sep 12 '11 at 10:46
    
Generally speaking, I prefer Anders' CSS approach. Most people misuse or don't understand print style sheets, but they make life so much easier with these types of requests. I do have a blog post that covers some of the basic steps: mike-greene.com/2010/04/print-formatting-via-css. The guide Anders posted is good too. –  webdes03 Oct 13 '11 at 3:40
add comment

It is not a good option if you require generic print functionality but SQL Reporting Services is great for building custom reports and it comes with different built in export functions.

However it requires some extra work eg. you need to build your reports separately, you need to take care of integration etc. so maybe it is overkill for your requirements.

Some additional info:

Overview of Reporting Services and SharePoint Technology Integration

share|improve this answer
    
Thanks, Vedran. We'll be using SSRS with SP, so this is definitely a good, free option. –  Alex C Sep 12 '11 at 12:38
add comment

For printing Lists you can use the http://spprintlistbutton.codeplex.com/.

share|improve this answer
    
Welcome to SharePoint Stack Exchange! While this may theoretically answer the question, we prefer inclusion of the essential parts of the answer here, and to provide the link for reference. See How to Answer for general guidelines. –  Alex Angas Sep 13 '11 at 9:53
    
Thanks, user4737 and Alex. The printing utility will come in quite handy for lists :) –  Alex C Sep 13 '11 at 10:46
add comment

I did this through a httpmodule that checks for the querystring PrinterFriendly=True and when that is set on any page in SharePoint, it swaps out the masterpage for a printerfriendly one. Here's some of the code:

    public void Init(HttpApplication context)
    {
        context.PreRequestHandlerExecute += new EventHandler(PrinterFriendlyMasterPage_PreRequestHandlerExecute);
    }

    void PrinterFriendlyMasterPage_PreRequestHandlerExecute(object sender, EventArgs e)
    {
        Page page = HttpContext.Current.CurrentHandler as Page;
        if (page == null) return;

        // If the request originates from a Publishing Page then we have to
        // change the master page on the current Sharepoint Web instance object
        // (of course we don't want to persist this change since it would
        // change the master page permanently..for all users).

        if (page is PublishingLayoutPage || page is TemplateRedirectionPage)
        {
            HttpContext context = HttpContext.Current;

            if (ShouldOverrideMasterPage(context))
            {
                SPContext.Current.Web.MasterUrl = Utility.GetSetting("PrinterFriendlyMasterPage_MasterPageUrl");
                SPContext.Current.Web.CustomMasterUrl = Utility.GetSetting("PrinterFriendlyMasterPage_MasterPageUrl");
                page.Load += new EventHandler(application_page_Load);
            }
        }
        else
        {
            // Now, if this is a normal wss 3.0 page hook into
            // the PreInit event (just before the ordinary Page event
            // cycle starts.            
            page.PreInit += new EventHandler(PrinterFriendlyMasterPage_PreInit);
        }
    }

    void PrinterFriendlyMasterPage_PreInit(object sender, EventArgs e)
    {
        try
        {
            Page page = sender as Page;
            if (page == null) return;
            if (page.MasterPageFile == null) return;

            HttpContext context = HttpContext.Current;

            if (ShouldOverrideMasterPage(context))
            {
                page.MasterPageFile = Utility.GetSetting("PrinterFriendlyMasterPage_MasterPageUrl");
            }

        }
        catch { }
    }

    private bool ShouldOverrideMasterPage(HttpContext context)
    {
        return GetQueryStringSwitch(context, Utility.GetSetting("PrinterFriendlyMasterPage_QueryString"));
    }

    private bool GetQueryStringSwitch(HttpContext context, string queryString)
    {
        try
        {
            if (!String.IsNullOrEmpty(context.Request.QueryString[queryString]) &&
                Boolean.Parse(context.Request.QueryString[queryString]))
            {
                return true;
            }
        }
        catch { }
        return false;
    }
share|improve this answer
    
Very neat, Steve. Thanks for sharing the code. –  Alex C Sep 12 '11 at 12:26
1  
Seems a bit excessive to use an HttpModule for this (especially performance wise) when almost the same can be achieved with a simple css file. What are the advanages for doing this serverside instead of doing it on the client? –  Anders Rask Sep 12 '11 at 15:14
    
@steve-lineberry contact me on chat if you need me to merge your two accounts. You have another account with +1000 rep ;) –  Anders Rask Sep 12 '11 at 15:16
    
@Anders-Rask, I sent the chat, I think i did it correctly. Let me know if I didn't. –  Steve Lineberry Sep 12 '11 at 18:25
    
I agree the httpmodule might be a little excessive, but I feel like the flexibility is there. I didn't include in my code above, but I had other switches to apply such as whether or not to include the quicklaunch, some other company specific items on the page, etc. Those are things I couldn't do with a plain css file. –  Steve Lineberry Sep 12 '11 at 18:28
show 1 more comment

The PDF Converter for SharePoint adds a lot of PDF Related functionality to SharePoint, including the PDF button you are after.

It comes with both SharePoint Designer and Nintex workflow activities as well as a host of other PDF related functionality such as PDF Security, Merging and watermarking.

More here.

Note that I worked on this product so the usual disclaimers apply.

share|improve this answer
    
Thanks, Muhimbi. Very nice product and one that's on our eval list for PDF. –  Alex C Oct 12 '11 at 11:08
add comment

Check out also Smart Print Pro. It can print lists or list items according to user defined templates and export it to PDF

Check it out - http://www.infowisesolutions.com/product.aspx?id=SmartPrintPro

share|improve this answer
1  
Welcome to SharePoint! We require relevant answers and disclosure of any affiliation with products or websites. Please see May I promote products or websites I am affiliated with here? for guidelines. –  Kit Menke Oct 13 '11 at 12:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.