SharePoint 2013 PDF Preview in hover panel

SharePoint 2013 Enterprise Search results has the ability to preview documents using Office Web Apps Server i.e. Microsoft Office Document (Word, Excel, PPT etc) & Web Pages etc. 

Issue:-  The preview of PDF documents is not implemented or supported using Office Web Apps.

Therefore, I created my own PDF preview for Enterprise Search results by customizing the new search Display Templates. 

Step 1:-  Navigate to Site Settings of Search Center
Step 2:-  Click Master Pages and Layout under Web Designer Galleries
Step 3:-  Click Display Template -> Search Folder as shown below:-


Step 4:-  Navigate to Item_Default_HoverPanel.html file


Step 5:- Download the HTML file and open in nodepad editor and add object tag as show below:-




<object data="_#= ctx.CurrentItem.DocumentLink =#_" type="application/pdf" width="100%" height="300px" >      
    </object>


where DocumentLink is the Managed Property which will link of the PDF file. 
If this managed property doesn't exists in the Template section, then we need to add manually. 
Before that check the managed property name properly in search schema.













Check the  Search Center URL carefully, If its not updated. Update it carefully.

Check in and publish the file and start browsing .





















Happy Coding..

No comments:

Post a Comment