Skip to end of metadata
Go to start of metadata

What is it?:

Document Preview is embedding a document display mechanism into the item display page. It makes the distance between the item in your repository, and the end user smaller as PDF's no longer require the user to have a PDF Viewer installed on their computer. And its faster, as the document begins loading in the page.

Before installing, be sure to check out Google's Terms of Service, and check that your usage is consistent with your institution's licensing policies, and is consistent with Google's usage policies. Additionally, there are limitations to how far this method can be customized, in which case another solution, such as @mire's document streaming would make more sense.

Document Preview in JSPUI

Document Preview in XMLUI

Document Preview with Google Docs viewer can be installed on either XMLUI or JSPUI, as it is just embedding a web service on your site.

JSPUI Instuctions


  • dspace-jspui/dspace-jspui-api/src/main/java/org/dspace/app/webui/jsptag/ (Item Display Page)
  • dspace/modules/jspui/src/main/webapp/utils.js (Custom Javascript)


  1. Patch to add the preview button and the hidden row that contains the iframe.
  2. Copy utils.js from dspace-jspui/dspace-jspui-webapp/src/main/webapp/utils.js to dspace/modules/jspui/src/main/webapp/utils.js
  3. Patch utils.js to add some additional needed functions.
  1. The javascript functions do make minor use of jQuery, which can easily be added:

XMLUI Instructions

Best practices are to put customizations into a theme directory, and not to modify the dri2xhtml files.

Additional Javascript function, note that you will need to use jQuery.
Add to dspace/webapps/themes/your-theme/lib/yourtheme.js

XSL overrides. This adds the "or Preview" link to the item downloads section, as well as an empty div hiding in the table.
Add to dspace/webapps/themes/yourtheme/yourtheme.xls

Essentially this works by "Preview" making a JavaScript call to create an iframe with a specified source (of your pdf bitstream).

NOTE: I originally posted this concept at Document Preview in DSpace, using Google Docs Viewer