×
Search results provided by Azure Search - read how I built it in this post.
Max Melcher

4 minute read

Preview of Office Documents (this includes PDF) is a huge benefit when you are searching for information – you can quickly identify if the document is the one you are looking for or skimming/scanning a document efficiently. To get the preview up and running you have to install Office Web Apps 2013 – PDF preview was added in March Public Update 2013 – that’s great, many clients have asked me why there is no support in the 2010 stack. But its 2013 – so let’s install Office Web Apps 2013 for SharePoint 2013!

Overview

I did the following steps on my SharePoint 2013 DEV environment. The SP2013 environment was already on March PU because of the awesome AutoSPInstaller/AutoSPSourceBuilder combo. As host I used a virtualized (Hyper-V) Windows Server 2012 with 4 cores and 5gb RAM on my Notebook (Lenovo W520).

Requirements

You can’t install Office Web Apps on a SharePoint or SQL Server. Additionally the SharePoint Server has to use claims-based authentication. Read all the requirements here.

7 easy steps!

  1. Install the PreRequisites
  2. Restart the computer
  3. Download and install Office Web Apps 2013
  4. Download and install March Public Update for OWA 2013
  5. Create the OWA Farm
  6. Configure the binding on the SharePoint side
  7. Do a full crawl

PreRequisites for Server 2012

Note: For PreRequisites of Server 2008 R2 read the technet article. If you can not install KB2592525 read this blog post by Markus Nöbauer.

The installer of the Office Web Apps 2013 is a little bit limited – other than the SharePoint 2013 it does not configure the host. But at least you can automate the whole process. Run PowerShell as admin on the OWA server:

Import-Module servermanager
Add-WindowsFeature Web-Server, Web-WebServer, Web-Common-Http, Web-Static-Content, Web-App-Dev, Web-Asp-Net, Web-Net-Ext, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Includes, Web-Security, Web-Windows-Auth, Web-Filtering, Web-Stat-Compression, Web-Dyn-Compression, Web-Mgmt-Console, InkAndHandwritingServices, Web-Net-Ext45, Web-Asp-Net45

Restart the computer afterwards.

PowerShell addicted - starting to automate the PreRequisites installation.

Download and install Office Web Apps 2013

The installation is quite simple, hit next several times – nothing magic here.

OWA installation folder

OWA installation in progress

OWA installation in progress

Download and install the March Public Update

After the installation just copy the OWA March 2013 PU on the box and install it. Again, an easy task.

Installing March PU 2013

Create the OWA Farm

After installation and patching, we have to use PowerShell again:

New-OfficeWebAppsFarm -InternalURL http://owa2013.demo.com -AllowHttp –EditingEnabled

With New-OfficeWebAppsFarm – you have certainly guessed it - we created the first node of our OWA farm, just replace the internal url with your hostname/FQDN. Because I have a simple DEV environment I did not use https and allowed editing – for editing you need Office licenses, view-only is free (awesome, thanks!). Add the OWA binding on the SharePoint machine, run this in a SharePoint Powershell:

New-SPWOPIBinding -ServerName owa2013.demo.com –AllowHTTP 
Set-SPWopiZone -zone "internal-http"

Two commands and the two are coupled - great.

Preview

In my opinion seeing the document upfront is huge - a picture worth a thousand words - sooo true! Lets look at the result:

A preview in a document library

A picture is worth a thousand words - I like the preview.

Enable PDF Preview in Search results

Wictor wrote a nice article about how to enable the PDF-Preview - if you followed my guide you do not need to enable it, it’s already set. The only part that is missing is the Display Template.

The quick and dirty Powershell approach to enable PDF Previews in search results:

$tenantOwner = Get-SPEnterpriseSearchOwner -Level SSA
$ssa = "Search Service Application" #adjust if you renamed the 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 with Preview" -Rules $ruleCollection -RulePriority 1 -DisplayProperties "Title,Author,Size,Path,Description,EditorOWSUSER,LastModifiedTime,CollapsingStatus,DocId,HitHighlightedSummary,HitHighlightedProperties,FileExtension,ViewsLifeTime,P
arentLink,ViewsRecent,FileType,IsContainer,SecondaryFileExtension,DisplayAuthor,docaclmeta,ServerRedirectedURL,SectionNames,SectionIndexes,ServerRedirectedEmbedURL,S
erverRedirectedPreviewURL" -DisplayTemplateUrl "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Word.js" -OptimizeForFrequentUse $true

Do a full crawl

There is one managed property containing the link how to embed the preview of the document - this one is built during a crawl. So just do a full crawl and everything should be set.

Short video

If you wanna see the Preview in action, watch the following video:

References:

The Server must be joined to a domain: http://bernado-nguyen-hoan.com/2013/01/22/cant-create-new-office-web-apps-farm-the-server-must-be-joined-to-a-domain/

Install PreReqs for OWA RC: http://blogs.itacs.de/Consulting/Lists/Beitraege/Post.aspx?ID=70

New-OfficeWebAppFarm: http://technet.microsoft.com/en-us/library/jj219436.aspx

New-SPWOPIBinding: http://technet.microsoft.com/en-us/library/jj219441.aspx

Set-SPWopiZone: http://technet.microsoft.com/en-us/library/jj219439.aspx

Office Web Apps Powershell cmdlets: http://technet.microsoft.com/en-us/library/jj219457.aspx

Do you like it?

Questions, comments or feedback, just hit the comments!

comments powered by Disqus