Tag Archives: SharePoint; Powershell; pdf; mime

2 possible solutions to PDF’s not displaying in browser when served up from SharePoint

I’ve run into this situation a few times and the fix was pretty easy.

The scenario goes like this: A user clicks a PDF file in sharepoint and can’t open it in the browser (instead they have to open it in Adobe Reader)

I’ve seen two fixes for this:
1) involved adding the mime type to the web app – this was a little elusive to me at first – sharepoint keeps tabs on mime types separately than IIS does – I had originally looked in IIS and thought everything was ok..
This can be checked with powershell
$Web = Get-SPWebApplication “http://mysharepointsite.myurl.com”
$Web.AllowedInlineDownloadedMimeTypes – this will list out all the mime types,
if you dont see “application/pdf” in the list, then you can add it like this:
$Web.AllowedInlineDownloadedMimeTypes.Add(“application/pdf”)
$web.Update()

So that was the first approach.

The next approach involved looking at the ‘safe’ settings for a document library – this too was a little elusive, becasue this is generally set at the site collection level – I don’t even think there is an option in the gui to set this for a document library in SharePoint 2010 (RTM) So again it’s gotta be done with powershell

I documented that here:  http://basementjack.com/uncategorized/pdfs-not-openi…oint-2010-site/ ‎