PDf preview not working in SharePoint 2013 search

Tanmoy Das 806 Reputation points
2021-01-19T05:23:48.693+00:00

Hi Guys,

For a client, enabled pdf preview using PowerShell.

https://www.sharepointdiary.com/2014/06/enable-pdf-preview-in-sharepoint-2013-office-web-apps.html

It worked for the test env but not for Prod. Both the environments are using same office web apps farm.

Any idea? Am I missing anything?

SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,900 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Echo Du_MSFT 17,141 Reputation points
    2021-01-20T01:53:21.127+00:00

    Hello anonymous user ,

    PDF preview for SharePoint 2013 integrated with Office Web Apps Server isn't enabled by default.
    You could run the below script to enable PDF previews in SharePoint 2013 search results.

    Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue  
       
    $TenantOwner = Get-SPEnterpriseSearchOwner -Level SSA  
       
    #Search Service application name  
    $ssa = "Search Service Application"  
       
    $Rule = Get-SPEnterpriseSearchPropertyRule -PropertyName "FileType" -Operator "IsEqual"  
    $Rule.AddValue("pdf")  
    $RuleCollection = Get-SPEnterpriseSearchPropertyRuleCollection  
    $RuleCollection.Add($rule)  
       
    $Item = New-SPEnterpriseSearchResultItemType -Owner $TenantOwner -SearchApplication $ssa -Name "PDF Preview" -Rules $RuleCollection -RulePriority 1 -DisplayProperties "Title, Author, Size, Path, Description, EditorOWSUSER, LastModifiedTime,CollapsingStatus,DocId,HitHighlightedSummary,HitHighlightedProperties,FileExtension,ViewsLifeTime,ParentLink, ViewsRecent, FileType, IsContainer, SecondaryFileExtension, DisplayAuthor, docaclmeta, ServerRedirectedURL, SectionNames,SectionIndexes,ServerRedirectedEmbedURL, ServerRedirectedPreviewURL" -DisplayTemplateUrl "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Word.js" -OptimizeForFrequentUse $true  
      
    

    Thanks,
    Echo Du

    =======================

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.