A question I got from a customer today was “How can I add a print button to data view web part which will print all documents in the view?”
Well, we have a product called iMUSH Print that allows you to print selected items/document from out of the box list views, and merge them into one PDF file for easy printing.
But the question remains, how do one connects this print functionality to a data view web part?
Well, lists or libraries, the answer is simple and took me about an hour to create a working POC.
First, lets have a look at out of the box iMUSH print feature in standard library view:
One thing to note, is that you can either use the checkboxes to select items for printing or click the print menu and select what you wish to print in the popup:
Ok, so obviously, this popup “knows” how to get a list of items for print. We will use this parameter to send the items form the DVWP.
Now, to the DVWP in SharePoint Designer:
2 changes are needed in the DVWP,
1. Add a print button HTML just before the <table> tag of the DVWP items:
you will need to replace the url “/iMUSH/” with your real site URL, and the list id ‘5678…’ with your actual list/library GUID.
2. Locate the <tr> tag inside your DVWP items table, and add an “itemid” attribute to it:
That’s it for the DVWP.
My favourite way about it is just adding a content editor web part.
Just insert this JS code:
and you are done!
Now, you can click print on the DVWP to print all items that are displayed in the web part, even after filtering but the user:
Just remember, this functionality requires a license for iMUSH Print.