Showing posts with label Office Web Apps Server 2013. Show all posts
Showing posts with label Office Web Apps Server 2013. Show all posts

Friday, April 5, 2013

SharePoint 2013: PDF Support and Behaviors - The Whole Story


Check out the whole SharePoint 2013 Solution Series
New Titles Added Weekly!

EXECUTIVE SUMMARY

SharePoint 2013 supports PDF documents out-of-the-box. Initially, web applications do not allow opening PDFs in the browser, however, by adding PDF as an allowed MIME type, browser rendering via Adobe is achieved.

Office Web Apps server provides Office document previews and rendering in Search results without the need for client applications installed (e.g. Word, Excel, etc.). However, once SharePoint is bound to Office Web Apps, PDF documents no longer open in the browser.
There are two workarounds –





1)      Configure PDF items to render as Word Items which allows PDFs to open and preview in Search within Office Web Apps
2)      Modify the PDF Item display template which allows PDFs to render in the browser via Adobe. Modify the PDF hover template to display previews.
These workarounds take care of Search, but PDFs will still open in the client application (e.g. Adobe) from Document Libraries. The solution here is an update to Office Web Apps. The February/March 2013 Update to Office Web Apps server supports opening PDFs from document libraries within Office Web Apps.

The following table summarizes the various PDF rendering and preview behaviors:



 

Search PDF Preview

Search Open (clicking on result)

Document Library Open (clicking on Document)

Out of the Box (Strict Web App)

 

Available by modifying the Display Template

Opens in Adobe or associated client application

Opens in Adobe or associated client application

Out of the Box

(Permissive Web App or Allowed Mime Type of PDF)

Available by modifying the Display Template

Opens in web browser and search term is passed into Adobe

Web Browser

Office Web Apps Server

(October 2012 Release)

Two options:

1.       Display template (shows in Adobe web)

2.       Modify Result Type to use Word Item (shows in Word App Web)

Opens in Adobe or associated client application.


Opens in Browser with modification of display template

Opens in Adobe or associated client application.

 

Office Web Apps Server (Feb/Mar 2013 Update)

Two options:

1.       Display template (shows in Adobe web)

2.       Modify Result Type to use Word Item (shows in Word App Web)

Opens in browser using Word Web App

 

Can use templates to display in Adobe Web.

Opens in browser using Word Web App

 

If not bound to WordPDF – Opens in Adobe or associated client application.

 
 


It is also worth mentioning that if Office Web Apps is not used for Search results of PDFs, the opening of PDFs in the browser passes the search terms into Adobe and thus finds the occurrences within the document. An example of this “search term pass-through” is displayed below:











Based on my investigations and modifications, when using Office Web Apps server with SharePoint, there are two overall options when handling PDFs. One provides a more consistent user experience and the other provides the most functionality. These options are outline below:
Most Consistent User Experience
The most consistent user experience would be to use Office Web Apps server (with the update) to enable opening of PDFs from libraries in the browser and to modify the search result type to render PDFs as Word Items which enables both preview and opening of the documents from Search results within Office Web Apps.
Most Functionality
The option that provides the most functionality is to use Office Web Apps for document libraries such that PDFs are opened within the browser but then use customized search templates to preview and open PDFs from Search results thus providing the search term pass-through functionality as described above.  For the most consistent preview, use a customized copy of the Word item hover panel template (explained in the last section of this post).
The rest of this post steps through the details and explains how to accomplish the various options and behaviors.
 
OUT-OF-THE-BOX BEHAVIOR (without Office Web Apps)
 
Web Applications are created with the Browser File Handling option set to Strict. This means that only the default allowed MIME types (correlates to document types such Word, PDF, etc.) can open and display within the browser without prompting the user to Open or Save the document. PDF is not one of those default MIME types and thus, the user is prompted when attempting to open a PDF document:

 
The recommended way to enable PDFs to be opened in the browser is to add the MIME type to the allowed list of types by using PowerShell commands:

$webApplication = Get-SPWebApplication "http:/yourwebapplicationurl"
$webAppApplication.AllowedInlineDownloadedMimeTypes.Add("application/pdf")
$webApplication.Update()
Source: http://social.technet.microsoft.com/wiki/contents/articles/8073.sharepoint-2010-and-2013-browser-file-handling-deep-dive.aspx#DownloadFunctions

The other easy option, which is not recommended, is to modify your web application (via Central Admin) and change the Browser File Handling property to Permissive:




Either method will allow PDF files to be opened in the browser. A neat experience in search results is that the search term is passed into Adobe and the terms are highlighted in the document:

 












To get a PDF preview in the search results, you may follow my original idea and post.
 
 
OFFICE WEB APPS (October 2012 Release Version)

Once Office Web Apps is installed and configured, by surprise, PDF documents are no longer opening in the browser. Neither from document libraries nor from the search results. So there two options at this point (at least for the search results).

1. Follow Wictor Wilen's post to use the Word Item template for PDFs. This method both shows a preview and opens up PDF search results in the Office Web App's Word App Viewer.

2. Use my original method for creating a PDF Preview to generate the preview.
Follow these steps to allow opening of the PDF document in the browser via Adobe (maintaining the search term pass-through functionality:

Modify the Item_PDF.html in the display templates folder.
Replace this line:
            ctx.CurrentItem.csr_OpenControl = "PdfFile.OpenDocuments";

With this one:
     ctx.CurrentItem.csr_OpenApp = "word";





Problems solved, right? At this point the search is fixed but PDFs don't open from document libraries in the browser. That's where the Office Web Apps Update comes in to play!


OFFICE WEB APPS PUBLIC UPDATE (Feb/Mar 2013)

There was a cumulative and public update released in early March 2013 that adds additional support for PDFs in SharePoint 2013 using Office Web Apps server. What does this do for us??

The update adds a new application type named WordPDF. It allows PDFs to be opened from document libraries in the browser using the Word App Viewer. What about search?

For search, there is no change. You either need to copy the PDF Result Type and configure it to use the Word Item or modify the search display templates. (Same options as above).

However, I have come up with a hybrid approach that provides a consistent preview using the Word App Viewer but also provides the rendering of PDFs in the browser through Adobe with the search term pass-through!

Open SharePoint Designer and navigate to the search display templates (similar to the steps here).
Find Item_PDF.html. Right-click and select Copy:

 
Right-click again and select Paste:


This process creates a copy of the file which appears at the bottom of the list. Find the copy and rename to something different (such as Item_PDFCustom.html):

 Right-click the new file and select Edit File in Advanced Mode:


Rename the title:


Change the hoverURL:




Replace this line:
ctx.CurrentItem.csr_OpenControl = "PdfFile.OpenDocuments";

With this one:
ctx.CurrentItem.csr_OpenApp = "word";


Save the file. This handles the opening of the PDF document in the browser. Now for the preview.

Locate Item_Word_HoverPanel.html. Right-click and select copy:


Right-click and select Paste:




 
 
Rename the copied file (should be the same name you used for the hoverUrl value):
 

Right-click the new file and select Edit File in Advanced Mode:
 

 
 
Change the title:


Save the changes! Onto the Search Center!

In your Search Center, select Site Settings from the Settings menu (gear).
Under Site Collection Administration, click on Search Result Types:



 
 


Scroll down and find the PDF entry. Select Copy from the drop-down menu:

 
 

Give the type a unique name and select the PDF Customized Item as the display template:




 Click Save.

Now, the search results display previews using Office Web Apps:


And the documents open in Adobe with the search term pass-through:




CONCLUSION
There are various options and behaviors when handling PDFs in SharePoint 2013. Using Office Web Apps server somewhat forces you down a customized search experience path. The easiest and most consistent option is to have Office Web Apps handle all PDF interactions via the Word App Viewer. Providing the search term pass-through is another option but requires display template modification as explained in this post. I hope this post provided insight into this topic.
 






Thursday, October 4, 2012

Installing Office Web Apps Server for SharePoint 2013


Check out the whole SharePoint 2013 Solution Series
New Titles Added Weekly!

I wanted to evaluate Office Web Apps Server in SharePoint 2013 so I could see what the document previews would look like and understand the overall editing functionality. Therefore, I hijacked one of my staging servers and decided to install Office Web Apps Server. The server you choose can't have SharePoint running on it or any web application running on port 80. Also, Microsoft Office (or any Office component) cannot be installed.

The OS on my server was Windows Server 2008 R2 so I had to follow those directions. For Windows Server 2008 R2 you need to have the following:

  • Windows Server 2008 R2 Service Pack 1 and all required updates

  • .NET Framework 4.5 RC

  • Windows PowerShell 3.0

  • KB2592525

  •  
    Apparently this server did not have PowerShell 3.0 or the KB2592525 patch. So I needed to download and install those items first.
     
    Then I needed to run add the proper roles using the following in PowerShell:
     
    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,Ink-Handwriting,IH-Ink-Support
    
    
     
     
    I noticed in the output as shown in the image, that a restart was needed. So I did not even take a chance and rebooted the server.
     
    Next it was time to install the Office Web Apps Server. I just searched for the product and found the download:
     
     

     
    

    I downloaded the package and ran the installation - pretty straightforward.

     
     
    Next it was time to create the new Office Web Apps Farm on the server via PowerShell. Since this was for evaluation purposes, I used the test environment configuration:
     
    Import-Module OfficeWebApps
    New-OfficeWebAppsFarm –InternalURL http://servername –AllowHttp -EditingEnabled
    
     
     
     
     Since I enabled editing, I needed to confirm the operation:
     

    The operation resulting with all of the properties being displayed:


    The next step was to test the Office Web Apps server using a browser to confirm that http://servername/hosting/discovery produced a wopi-discovery response. It did:

     
     
     
    So that was it on the Office Web Apps server side. Now I needed to switch the the SharePoint 2013 server and do some magic there.
     
    
    
    Create the new binding:
    New-SPWOPIBinding -ServerName <WacServerName> -AllowHTTP




    Set the zone:
    Set-SPWopiZone –zone “internal-http”

    If you are using HTTP, you need to allow OAuth over HTTP by using the following commands:

    $config = (Get-SPSecurityTokenServiceConfig)
    $config.AllowOAuthOverHttp = $true
    $config.Update()




    I didn't need to do this previously but while I was setting up my production server, I ran into an OWA issue. The answer was to run the above commands which I found in a forum who received the information from here.


    That's it! Bring up a document library with Office documents:




    Search for Office documents: (may need to perform a full crawl before the preview kicks in)


    This was very easy to install and implement! I was very suprised it worked the first time. It took a bit for everything to warm up and work but I really did not have to do much fiddling!

    Wednesday, October 3, 2012

    SharePoint 2013: Document Library and Search Results Document Preview with Office Web Apps Server


    Check out the whole SharePoint 2013 Solution Series
    New Titles Added Weekly!

    I kept reading that if you have Office Web Apps Server up and running, you can connect it to your SharePoint farm and then, automagically, document previews will start appearing both in Search and in Document Libraries. I have not found any examples of what this document preview looks like so I had to take matters into my own hands.

    I finally installed Office Web Apps Server on one of our staging servers and connected it to a SharePoint 2013 farm in stage. After some warming up, the document previews for Office documents started working like a charm. For the Search Results, I needed to run a full crawl again. This is because the javascript in the Display Templates uses alternate URLs (defined by crawled properties) which take the Office Web Apps server and the document preview into consideration.

    I essentially followed the steps here: http://technet.microsoft.com/en-us/library/jj219455(v=office.15).aspx and used the standalone test environment section using Internal HTTP. I have some screenshots of the steps so I will probably post my installation journey as well. (UPDATE: The installation post is here.)

    However, I was so excited that the Office document preview worked that I wanted to share the results. Below are some screenshots.

    Search Results - Hovering over a Word document (click image to enlarge)




    Document Library - Selecting the elipsis (...) on a Word document library item (click image to enlarge)
     
    The previews under Office Web Apps server is only for Microsoft Office documents. Therefore PDF previews do not render. However, at least for the search results, I have a PDF Preview solution.
    
     
    
    The document preview is the "cool" part about Office Web Apps server but not the business value part. The business value is the ability to edit and work with Office documents in the browser without the need for local Office applications.

    What does this mean? This means that business users may interact with Office documents through SharePoint directly in the browser on any device. So whether it is a laptop, desktop, smart phone, or iPad - there are no constraints in making those last minute edits.


     

    Matched Content