Have heard from a lot of people who are having some challenges putting all the pieces of this solution together, particularly the calculated field for the print icon. Providing detailed instructions and a screenshot to get started.
Start from a new team site:
- Create a new subsite from the Collaboration template using the Team Site template.
- Use listprint for the site name and URL.
- Create a new picture library named “Images1”
- Upload the print icon to the picture library. Download image here
- Create a custom list named “List”
- Add the following columns to the list:
- Column name: Printed | Column Type: Text | Default value: No
- Column name: Print Item | Column Type: Calculated Column Download calculated field formula example here
- Add a new item to the list.
- Click on the new item link.
- From the standard DispForm.aspx page select Settings > Edit page
- Add a new Script Editor web-part to the page (located in the Media and Content Category in web part gallery)
- Set the Script Editor web-part properties zone index to 2 from the web part settings, layout section.
- Select Edit Snippet in the Script Editor webpart and paste in the following jQuery/CSS-Download script here
- Update the siteUrl variable in the jquery to use your site URL as required.
- Select Page, Stop Editing from the SharePoint ribbon.
- From site contents select “List”
- Select a link to one of the two items in the list, select the Print button.
- From site contents select “List” and notice the first item in the list has been updated to reflect Printed=Yes.
That’s it to getting started.
I have paired down the solution to get you started and make additional customizations specific to your requirements for example the listitemid that gets updated is hard-coded to the first item id since my solution depends on a SharePoint Designer workflow which I did not package up in the wsp (Coming soon) This can be easily updated to use your own jQuery inside the script editor web-part to obtain from the querystring on dispform.aspx or from a custom field that is populated from a SPD workflow when the item gets created. You can easily create a list on any existing SharePoint 2013 or Office 365 SharePoint site providing you update the script and calculated columns to reflect the correct URLs and image source in the jQuery embedded in the Script Editor web-part and also the Print Item calculated field formula.
Added Functionality verses standard list item form:
* Add a print button to a SharePoint list item form.
* Displays a print icon linked to the custom print preview form.
* Tracks which list items were printed by the user. Works on both Office 365 and on-premises versions of SharePoint 2013.
Solution designed to meet a requirement from a customer to allow users to easily print a list item from the primary SharePoint list view page in a layout that maximized the allowable printing real-estate while also removing most of the SharePoint toolbars etc. from the printed page. Also, the customer requested that we track which items had been printed since this solution was part of a larger scheduling solution for SharePoint. Since the customer is hosting their SharePoint on Office 365 in the cloud we opted to use jQuery and CSS directly on the list item form. For layout we opted to use a custom list item display form and modify the XSL although this is not necessary to support the jQuery and CSS for printing the list item.
- jQuery added to list item form with embedded jQuery and CSS overrides in a script editor web-part.
- Calculated field with a print icon and link to list item form added to the list view.
- Optional: Customized list item form layout using XSL.
Package as a SharePoint app that can be added to any site.
Create a custom print template.
Even in 2013 it is sometimes necessary to print to paper. With SharePoint being used more and more for scheduling and tracking systems, workflows, and calendaring the ability to print a SharePoint list item when necessary is an added benefit. With the advent of CSOM and JSOM developers are increasingly taking advantage of jQuery, HTML, and CSS to tackle specific gaps in the OOB SharePoint features and particularly in the O365 cloud version.