The below PowerShell script downloads a icon GIF image from Adobe named pdficon_small.gif, places it in the images folder under the 14 hive, associates it in the DOCICON.XML file, sets Browser File Handling to Permissive, and then runs IISReset.
$14 = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14"
$src = "http://www.adobe.com/images/pdficon_small.gif"
$dst = $14 + "\TEMPLATE\IMAGES\pdficon_small.gif"
$webClient = New-Object System.Net.WebClient
$webClient.DownloadFile($src, $dst)
$xml = New-Object XML
$xml.Load($14 + "\TEMPLATE\XML\DOCICON.XML")
$icoAsn = $xml.CreateElement('Mapping')
$icoAsn.SetAttribute('Key','pdf')
$icoAsn.SetAttribute("Value","pdficon_small.gif")
$icoAsn.SetAttribute("Open Control","SharePoint.OpenDocuments")
$xml.DocIcons.ByExtension.AppendChild($icoAsn)
$xml.save($14 + "\TEMPLATE\XML\DOCICON.XML")
Add-PSSnapin Microsoft.SharePoint.PowerShell
Get-SPWebApplication | ForEach-Object {$_.BrowserFileHandling = “Permissive”; $_.update()}
iisreset
The PDF Key was added to the DocIcon.XML with this PDF GIF image icon file.
Browser File Handling to "Permissive" will enable the PDF’s to be opened instead of only saved.
PDF docs now have the correct icon and are allowed to be opened.
Microsoft KB Article related to PDF Issue in SharePoint.
________________________________________________________________________
We can also enable opening PDF files is by adding the pdf extension to the allowed MIME types of the web application.
VIEW
$webApp
=
Get-SPWebApplication
"http://sp2010dev/"$webApp
.AllowedInlineDownloadedMimeTypes
$webApp
=
Get-SPWebApplication
"http://sp2010dev/"$webApp
.AllowedInlineDownloadedMimeTypes.Add(
"application/pdf"
)
$webApp
.Update()
$webApp
=
Get-SPWebApplication
"http://sp2010dev/"$webApp
.AllowedInlineDownloadedMimeTypes.Remove(
"application/pdf"
)
$webApp
.Update()
For those who have access to an internet connection, there are several options available to them. One option is to download free PDF viewers which are available both online and offline. Click here to get more information about find file extension.
ReplyDelete