Rocket NXT

To integrate PDF Highlighter with Rocket Folio NXT, update xhitlist.xsl template file.

Step 1: Include and init Highlighter JS

Update <xsl:template match="/"> section by adding the following to the end of document <head> section:

  <script type="text/javascript" src="/highlighter/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="/highlighter/js/jquery.pdf-highlighter.js"></script>
<script>
jQuery(document).ready(function() {
var hlConfig = {
highlighterUrl: "/highlighter"
};
$('a[data-uri]').pdfHighlighter(hlConfig);
});
</script>

This code snippet loads jQuery PDF Highlighter plugin and initializes it, attaching Highlighter to all links having data-uri attribute (which we add in Step 3).

We assumed here that Highlighter is available under the "/highlighter" path on the same IIS website (e.g. setup using reverse proxying).

Step 2: Add query attribute to the results table

Find search results table header, and add the data-query attribute. The relevant section looks like the sample below — the added line is #2.

<table width="100%">
<xsl:attribute name="data-query"><xsl:value-of select="list-section/query" /></xsl:attribute>
<tr>
<td class="hit-head" align="right" width="1%">&#160;</td>
<td class="hit-head">Title</td>
<xsl:if test="contains(/list-section/select, ';title-path')">
<td class="hit-head">Location</td>
</xsl:if>
</tr>

Step 3: Modify result links to PDF documents

Find the template <xsl:template name="build-document-link"> , and update the section that controls the PDF document link construction — so it looks like this:

<xsl:choose>
<xsl:when test="$content-type = 'application/pdf'">
<xsl:attribute name="data-uri"><xsl:value-of select="$path"/></xsl:attribute>
<xsl:attribute name="data-view-url">#!-- #EXECUTIVE:SCRIPT_NAME --#/<xsl:text/>
<xsl:value-of select="$path"/>
</xsl:attribute>
<xsl:attribute name="data-alt-url">#!-- #EXECUTIVE:SCRIPT_NAME --#/<xsl:text/>
<xsl:value-of select="$path"/>
</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="onclick">return fixupLink(this)</xsl:attribute>
</xsl:otherwise>
</xsl:choose>

Note that we added both uri and viewUrl attributes:

  • uri parameter will be used by Highlighter to locate the PDF document. Setup serving local files to properly map uri to a local file.

  • viewUrl parameter will be used in the document serving path so, when highlighting PDF viewer is used, the user receives the PDF document through Rocket NXT.

The above code snippet assumes that the $path node contains a valid path to the PDF document on file system. If your indexer transforms the path — so it doesn't reflect the file system path any more — you should store the original file path in another node (e.g. $title-path) and reference this node in line #3.


comments powered by Disqus