Friday, 27 September 2013

Open PDF documents in Browser Itself - SharePoint Document Library

         Open SharePoint 2010 documents library to open pdf documents in local drive, then how to open those pdf
in browser itself. Lets join a journey with me.................
  SharePoint UI                                 
  •  Central Admin.             
  •   Select WebApplication under Application Management.                      
  •    General Settings.
  •   Default Browser File Handling is Strict. Look like this
 

  •   Change the option Browser File Handling to Permissive.
  •     Perform iisreset and open pdf files in document library.       
    PowerShell

           Using powershell comment to set BrowserFileHandling property.

                Getting library from site.
                                       $web= Get-SPWeb -Identity “SiteUrl”
                                       $library= $web.Lists["LibraryName"]

                Check the BrowserFileHandling.
                            $library.BrowserFileHandling

                Set the value to Permissive
                           $library.BrowserFileHandling = "Permissive"
                           $library.Update()

  Perform iisreset and open pdf files in document library. 

  MIME Type:

            One more option is available to set MIME type, if the above techniques is went wrong,  go ahead this way.............
             
               Getting web application.
                             $curWebApp = Get-SPWebApplication "webappurl"    
  

                Add pdf in MIME type.   
                  $curWebApp.AllowedInlineDownloadedMimeTypes -contains "application/pdf"
                  $curWebApp.Update()

                 Check the PDF type.
                  $curWebApp.AllowedInlineDownloadedMimeTypes -contains "application/pdf"
                  Result : true

  Perform iisreset and open pdf files in document library.