Showing posts with label PDF. Show all posts
Showing posts with label PDF. Show all posts

Tuesday, September 6, 2011

How to open PDF files,HTML files in browser in Sharepoint 2010

Below are the few methods to Open PDF files,HTM files in browser in Sharepoint 2010 ::

Web Application level setting: Method 1 (UI)

• Go to SharePoint 2010 Central Administration > Application Management > Manage Web Applications
• Select the row of your web application
• Click General Settings in the ribbon
• Scroll down to Browser File Handling and select Permissive
• Click Ok

Web Application level setting: Method 2

1
2
3
$webApp = Get-SPWebApplication http://intranet.domain/
$webApp.BrowserFileHandling = "permissive"
$webApp.update()


Web Application level setting: Method 3 (recommended)


1
2
3
4
5
6
7
8
9
10
$webApp = Get-SPWebApplication http://intranet.domain/
If ($webApp.AllowedInlineDownloadedMimeTypes -notcontains "application/pdf")
{
  Write-Host -ForegroundColor White "Adding Pdf MIME Type..."
  $webApp.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
  $webApp.Update()
  Write-Host -ForegroundColor White "Added and saved."
} Else {
  Write-Host -ForegroundColor White "Pdf MIME type is already added."
}


Site Collection level


1
2
3
4
5
6
7
8
9
10
11
12
foreach ( $subsite in $site.allwebs ) 
 foreach ($list in $subsite.Lists) 
 { 
  if($list.browserfilehandling -eq "Strict") 
  { 
   $list.browserfilehandling = "Permissive"; 
   $list.update(); 
  } 
 } 
}


Site level ( SPWeb )


1
2
3
4
5
6
7
8
9
foreach ($list in $web.Lists) 
 if($list.browserfilehandling -eq "Strict") 
 { 
  $list.browserfilehandling = "Permissive"; 
  $list.update(); 
 } 
}


List Level


1
2
3
4
5
6
7
$list = $web.Lists["MyList"] 
if($list.browserfilehandling -eq "Strict") 
 $list.browserfilehandling = "Permissive"; 
 $list.update(); 
}



Hope this helps...

Popular Posts