Adding Print capabilities to Project Detail Pages

A user in the Project Server forums asked a question this week about whether it was possible to add printing capability to the Project Detail Pages in order to allow the ‘forms’ to be printed out as there is no print button available on the ribbon.


Out of the box, the printing capability in the Project Web Application is limited to the grids, including the schedule grids that are visible in a schedule PDP and uses a custom page to render the information as can be seen below.

Project Schedule PDP Grid Print

After a little experimenting with the Internet Explorer printing, it seems that PDP’s can be printed quite well directly from the browser, so I thought I would try and pull together a ribbon feature that enables PDP printing.

The feature consists of XML button definition and a little piece of JavaScript to determine if the button will be enabled or not. This is important so that the button can be disabled when the user is on the schedule page that has it’s own grid based printing function like the picture above. For the purposes of this feature, I have gone the quick route and do the check based on the name of the page, in this case if the page is called schedule.aspx the button will be disabled. You may need to modify this check if your schedule based PDP(s) have a different name.

Schedule PDP - Custom Print button disabled

The element.xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
	<CustomAction Id="Ribbon.Tabs.PDP.Home.Print"
				<CommandUIDefinition Location="Ribbon.Tabs.PDP.Home.Groups._children">
					<Group Id="Ribbon.Tabs.PDP.Home.Print"
						   Description="Print Custom Group"
						<Controls Id="Ribbon.Tabs.PDP.Home.Print.Controls">
							<Button Id="Ribbon.Tabs.PDP.Home.Print.PrintPDP"
									ToolTipDescription="Print the contents of the PDP"/>
				<CommandUIDefinition Location="Ribbon.Tabs.PDP.Home.Scaling._children">
				<CommandUIHandler Command="EnableCustomGroup"
								  CommandAction="javascript:return true;" />
				<CommandUIHandler Command="PrintPDP"
								  function disablePrintForSchedule() {
									var sPath = window.location.pathname;
									var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
									if (sPage.toLowerCase() == 'schedule.aspx')
										return false;
										return true;

The process of building the feature is exactly the same as outlined in but substitute the above code into the Element.xml file and change the feature name accordingly.

Once the feature is deployed and activated a Print button should available on the PDP ribbon that when clicked will invoke the Internet Explorer print dialog.

PDP Print Button

From my preliminary testing, the output is pretty good, as can be seen from this ‘Print to XPS’ below:

XPS Printer Output

I have uploaded the full source to Skydrive which can be downloaded from the link below.

Project PDP Print Page

Happy PDP printing Smile

6 thoughts on “Adding Print capabilities to Project Detail Pages

  1. Hi,
    I tried to deploy this but the printing icon is not showing up. Apart from getting this in the GAC and activating the feature, is there something special that I need to do? Thank you much.

    • All you should need to do is add the WSP via your User Solutions on the Project Server site, activate the solution, then the site feature and your away. I just tested this on a Project Online tenant and it worked without issue. What are you seeing?

  2. Pingback: How to get timesheet information in a javascript (Project Server 2013) | Hugues' blog about Project Server and other technologies

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s