Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

<map:match pattern="static/**.pdf">
<map:read type="ConcatenationReader" src="static/{1}.pdf">
<map:parameter name="requestQueryString" value="{request:queryString}"/>
</map:read>
</map:match>
<map:match pattern="static/**.jpg">
<map:read type="ConcatenationReader" src="static/{1}.jpg">
<map:parameter name="requestQueryString" value="{request:queryString}"/>
</map:read>
</map:match>
<map:match pattern="static/**.js">
<map:read type="ConcatenationReader" src="static/{1}.js">
<map:parameter name="requestQueryString" value="{request:queryString}"/>
</map:read>
</map:match>

Pre-compilation Process

For very large PDF's that will be accessed frequently, it might make sense to pre-compile the document viewer.  

This solution presumes that pre-compiled assets have been made accessible under the following path.

/bookview/<handle>/<seq>/index.html

Add the following code to template.xml (above)
//Isolate the handle and sequence number from the bitstream path
var matchArr = /\/bitstream\/handle\/([\d\.]+)\/([\d\.]+)\/.+\.pdf\?sequence=(\d+)/.exec(loc);
if (matchArr != null) {
if (matchArr.length > 3) {
//pre-compiled assets must conform to the following structure in order to be opened as an
//alternative
var precomp = "/bookview/" + matchArr[1] + "/" + matchArr[2] + "/" +
matchArr[3] + "/index.html";
    //make ajax call to determine if a pre-compiled asset exists. 
//If so, redirect to that page (which will terminate the load of the dynamic viewer)
//Otherwise the client-side html5 viewer will load as normal.
$.get(precomp, function(){
//if the get operation is successful, the following callback will be executed
//note that the remainder of this script will process
document.location=precomp;
});
}
}