Wednesday 23 May 2012

How to Open .pdf in your browser with SharePoint 2010

Hi all,

Today's issue came from the complain of a user as he was not allowed to directly open a .pdf file in his browser.
The only solution was to download the .pdf (even if it is set as Read Only) localy, then open it.

I found this well explained post on dmitry's blog.

I've tested and approved the Second Solution, via PowerShell Script :

[CODE]
$WebApp = Get-SPWebApplication http://webapplication.domain.net
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."
}
[/CODE]

Do not forget to change the Web App URL at the first line, to match to your Farm.


That's all folks


No comments:

Post a Comment