Skip Ribbon Commands Skip to main content
Help (new window)
Sign In
Navigate Up

PDF Menu Item


The Sharepoint AddDocLibMenuItems() Function in Core.js always executes Custom_AddDocLibMenuItems if a function by that name exists.  So to add menu items to a library all you have to do is put this code in a text file on your site then add the script to your Doc Lib View (AllItems.aspx for example) using a Content Editor Web Part.

I dug around in core.js found some useful functions including:
FindSTSMenuTable(sourceElement, Attribute) which seems to find the List View Items Table of a given source element by climbing up the DOM until it finds a tag with the given attribute name.  I used this to get to the first <a> link href which is the Relative URL of the PDF Document.

 I take this URL and append it as the 'File' Query String on my pdf.aspx viewer page and use that for the Action of the menu item.

This script has been added to the Complete PDF Solution here: