Open PDF files in browser from SharePoint 2010

By default, SharePoint 2010 doesn’t allow you to open the PDF files directly in the browser, Instead, it prompts a “Save” Dialog box. This is because of the Web application’s general settings. We can open PDF instead of save.

open pdf document browser sharepoint 2010

To Make SharePoint 2010 to Open PDF documents in browser: Go to Central Administration >> Application Management >> Select the web application >> and click on “General Settings”.

Now in “General Settings” Dialogue box, set the “Browser File Handling” to “Permissive”. Now you can open PDF documents in browser from SharePoint 2010.

sharepoint 2010 make pdf open browser

Lets use PowerShell to instruct SharePoint open PDF not save:

#Get web application 
$WebApp = Get-SPWebApplication "http://sharepoint.crescent.com"
#Set property as Permissive
$WebApp.BrowserFileHandling = "Permissive"
#Update the changes
$WebApp.Update()

BrowserFileHandling at List/Library Level:
In some cases, BrowserFileHandling setting of a list or library may override web application setting. Here is how we can reset:

#Get the Site collection
$site = Get-SPSite("http://sharepoint.crescent.com/sites/Sales")

#Get all webs
foreach ($web in $site.AllWebs) 
{
	write-host "Processing  $($web.Title)"

	#Get all lists
	foreach ($list in $web.Lists) 
	{
		#Check the browserfilehandling setting
		if($list.browserfilehandling -eq "Strict") 
		{
			Write-Host "Changing " $list.Title
			$list.browserfilehandling = "Permissive";
			$list.update();
		}
	}
}

Bother this will open other security holes? use AllowedInLineDownloadedMimeTypes

SharePoint 2010 determines whether to open the file in the browser or not based on the “AllowedInlineDownloadedMimeTypes” type property of the web application. You can add/remove file types to this property collection to control the behavior. Get the AllowedInLineDownloadedMimeTypes:

$WebApp = Get-SPWebApplication <web-App-URL>

$WebApp.AllowedInlineDownloadedMimeTypes

Add a File Type to Allowed Inline Downloaded Mime Types:

$WebApp = Get-SPWebApplication <web-App-URL>
$WebApp.AllowedInlineDownloadedMimeTypes.Add("application/pdf" )

#For Flash files, use: 
#$webApp.AllowedInlineDownloadedMimeTypes.Add("application/x-shockwave-flash")
 
$WebApp.Update()

A bit cleaner code would be:

$webApp=Get-SPWebApplication "http://SharePoint.company.com"

If ($webApp.AllowedInlineDownloadedMimeTypes -notcontains "application/pdf")
{
  $webApp.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
  $webApp.Update()
  write-host "PDF File type added"
} 
else 
{
  write-host "PDF File type already exists!"
}

Disable Open PDF in Browser

 $WebApp = Get-SPWebApplication <web-App-URL>

$WebApp.AllowedInlineDownloadedMimeTypes.Remove("application/pdf")
$WebApp.Update()

Found the Remove works only for newly uploaded files after this change.

Open PDF Files in Adobe Reader application Instead of Browser:

We can open PDF in a new window (in Adobe Reader’s application or any client application which can handle PDF) from SharePoint. By default, it opens in the browser. In fact, this is based on the client settings. If you want to open PDF documents in Adobe Reader, instead of the same browser window:

  • Open Adobe Reader,
  • Go to: Edit >> Preferences >> Category: Internet
  • Uncheck the option “Display PDF in browser “. 

However, in the latest version, this option has been removed! So the remedy is: Disable the Adobe reader add-on in the browser. Here is how: Go to Internet Explorer >> Tools >> Manage Add-ons >> Select “Adobe PDF Reader” and disable it! 

Open PDF Files in Adobe Reader Instead of Browser

Now, when you click on any PDF file, they’ll be opened in Adobe Reader instead of the browser.

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply