jQuery Plugin


Highlighter jQuery Plugin has been deprecated and is no under active development any more. For new integrations, it's highly recommended to use Highlighter JS instead.

The PDF Highlighter jQuery plugin allows seamless integration using simple JavaScript ajd jQuery.


The jQuery plugin is distributed with the Highlighter Server and can be referenced at URL http://yourserver:8998/js/jquery.pdf-highlighter.js. The latest version of the plugin script file can be found at http://api.highlight4.me/js/jquery.pdf-highlighter.js.

Add it to your HTML page after including jQuery. For example:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//api.highlight4.me/js/jquery.pdf-highlighter.js"></script>


The plugin is mostly data-driven and requires only a couple of configuration options to initialize.

Depending on your use case, check method specific examples when highlighting for a search query or for PDF highlight file.

Configuration Object Options#

The following plugin configuration options are available:

  • highlighterUrl - URL to Highlighter service used (cloud or self-hosted).
  • resolveDocumentBase - Set to true if you want the plugin to resolve relative href's using the URL of the current page. If set to string, its value will be used as a base URL. Otherwise, href value will be sent to Highlighter as it is.
  • resolveXmlBase - The same as above but for Adobe highlights XML location.
  • updateHref - By default, the plugin handles clicks on managed page elements (i.e. links). Set this option to true if you want the plugin to update the element's href attribute instead.
  • updateAttr - Name of HTML element attribute to update with created highlighting request URL.
  • viewerUrl (deprecated) - If present, viewerUrl will be prepended to URI-encoded highlighted document location. This option was used to open document in an alternative PDF viewer like PDF.js. Use of this option is deprecated as Highlighter now comes with a customized version of PDF.js viewer.
  • filterQuery: function(query) - Listener function used to filter query string before sending it to Highlighter.
  • onHighlightingLinkClick: function(link) - Link click listener. If it returns false, click will be ignored.
  • onHighlightingResult: function(results) - Listener for highlighting response JSON object. If it returns false, further processing (e.g. document open) will be prevented.

Supported Data Attributes#

Data attributes generally correspond to the web service request parameters:

  • href - The plugin checks the element's href attribute first, but, if not set, it will check the data-href attribute as well. The value may be transformed in accordance with the resolveDocumentBase option and is sent to the service as uri parameter.
  • xml - For compatibility with existing applications that use Adobe PDF highlight files, the plugin will first lookup for xml file reference in href fragment and query string. If not found, it will check the xml data attribute presence as well.
  • query
  • language
  • alt-url
  • view-url - PDF document location to use in Highlighting PDF viewer instead of href.
  • add-navigation
  • open-first-hl-page
  • remove-pages-without-matches
  • neighbour-pages

For detailed parameters description, see Highlighter API documentation.

Parameters common to multiple elements can be specified on a common parent. See them in action at https://api.highlight4.me/examples/