Well really there are four methods to print a SharePoint display form, and I’ll give you one method to print InfoPath-customized list forms. If you’ve gotten to this page, it’s because you or your users make heavy use of SharePoint lists, and the inevitable request came up “Ok this is great, but I can’t print this item, help!”. Off to Google we go, and there are a few different solutions out there. Which is best? What do I do? Like most things with SharePoint, there is no one right answer (sometimes there is!), but some are definitely easier than others or better depending on your needs. I'll show you a couple different common solutions out there in one place, and what worked for me.
For the sake of this post, I’m assuming the platform is SharePoint 2010. SharePoint 2007 and especially SharePoint 2013 would have different solutions using the new client-side object model (CSOM).
Print an InfoPath-based List Items
First, let’s take a look at the InfoPath version. If you use lists a lot then you probably know you can customize a list display/edit/new form using InfoPath. This can give you great flexibility with your form design, and keep things with the site owner in the business instead of having to call IT. Customizing your list with InfoPath is out of scope of this post, but you can follow the basic steps from Microsoft or watch a video from SharePoint-videos.com.
For this solution, most folks I have seen turn to Chris Kent’s solution on codeplex that ONLY works with SharePoint list forms that have been customized with InfoPath. It installed and worked fine, and added a button to the form and printed the form great! However, a very annoying popup “Chris Kent is awesome” kept popping up every time it was printed. We modified the solution code to remove this = happy client! It adds a Print section on the ribbon and Print icon on the actual list item like the image on the right. I have used this, and it filled the need.
The solutions below will also work for an InfoPath form, where you edit the display form, but of the item. These steps are outlined here.
Print a Default SharePoint List Item
The rest of these solutions deal with how to print default SharePoint list items. A couple of these are similar requiring no-code (server side anyway), and one that is a full server-side solution.
Solution 1 – Use SharePoint Designer and a Custom Action
I think this is the easiest and takes only a minute to implement. I first saw this mentioned in a TechNet forum post, and I was unable to find it again, sorry to the author! This solutions involves SharePoint Designer to create a custom action on the list. Let’s knock this out:
- Open SharePoint Designer 2010, click Open Site, and open the web that contains the list in question.
- Click Lists and Libraries on the left, and click on the List that you want to add the print button.
- On the ribbon under List Settings, click Custom Action –> Display Form Ribbon.
- Fill out the Custom Action screen.
- Give it a name and optionally a description.
- For the “type of action”, choose Navigate to URL and input the following:
- List a 32x32 print icon if you have one.
- For the Ribbon Location, this should already be filled out as Ribbon.ListForm.Display.Manage.Controls._children.
- You can find all of the default ribbon locations on MSDN.
- For my list, I changed “Manage” to “Actions” so the icon would appear in the Actions group and not the Manage group.
- Configure Rights Mask and Sequence as needed, but defaults can be used just fine. All available options for Rights Mask can be found here.
- Click OK, and you’re done.
Go open your list, and open in display form. You should see something like this. It’s not perfect, it’s a little small but it works and took less than 2 minutes. Try it out! You go a little further to clean it up by using some CSS to strip out the top nav and social icons and such using a technique similar to a previous blog I wrote to print a picture library.
Solution 2 – Use a Content Editor with jQuery
There are a couple different flavors of this, but the core solution is the same. Using the SharePoint UI, go to the list, edit the default list form via the ribbon, insert a content editor web part, and either embed the code on the page or call the code via a .txt file that fires the code via a button on the page. If you follow Emerson Bruce’s method for this, she gives some nice CSS to help clean up the view and make it nice for printing.
Solution 3 – Make a Print Item Column
Jim Parker over at www.nothingbutsharepoint.com did a nice write-up solution where basically we’re doing the same thing, but instead of a button on the page, we stuff the HTML in a calculated column that’s clickable that loads a nice print version that then you can just use your browser File->Print. Nice Jim!
Solution 4 – Full Custom Solution
If you needed this on a list of lists, you don’t want to have to edit all these lists, you want to make a feature that just does it. Bob Guidinger put a nice post using a server-side Visual Studio solution. While his example shows attaching to InfoPath list forms, you just need to change the Location and Button ID to work with regular list forms. Again, all of the default ribbon locations are on MSDN.
I saw another post of using Access forms to do this, however, how do I say this … no thanks. But for thoroughness, the link is provided. I hope this helps show the different ways folks in the community have come up with to address this need, and you try them out and find the one that works for you.
For more information on C5 Insight or this blog entry, please Contact Us