SharePoint 2013 PDF Preview List Item using Office Web Apps

Found this useful script from: http://www.wictorwilen.se
http://www.wictorwilen.se/sharepoint-2013-enabling-pdf-previews-in-document-libraries-with-office-web-apps-2013

Copy this Code to a file called preview.js:

function WictorsPdfPreviews() {
    SP.SOD.executeOrDelayUntilScriptLoaded(function () {
        filePreviewManager.previewers.extensionToPreviewerMap.pdf = [embeddedWACPreview, WACImagePreview]
        embeddedWACPreview.dimensions.pdf= { width: 379, height: 252}
    }, "filepreview.js");
    notifyScriptsLoadedAndExecuteWaitingJobs("wictor.pdfpreviews/previews.js");
}
WictorsPdfPreviews();

Upload this script as a js file to your script library.
Modify your MasterPage and add this line in the head:

<SharePoint:ScriptLink ID="ScriptLink9" language="javascript" name="~sitecollection/SiteAssets/scripts/pdfpreview/previews.js" runat="server" LoadAfterUI="false" />

The result now operates the same as a Word document preview:

Advertisements

Post a Comment

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s