Best way to open document with search already applied

53 views
Skip to first unread message

Richard Brown

unread,
Oct 25, 2014, 12:39:39 PM10/25/14
to pdfnet-w...@googlegroups.com
Hi,

I want to be able to open a document with a search already applied and the document open at the first search hit. Any other search hits will be listed on the Left Hand side, with this panel already viewable.

Is it possible to achieve this via a URL? i.e. something like &search=blue

If not, what is the recommended approach, that is reliable on all platforms, and reduced the delay or reloads before user sees search result.

Many thanks,

Richard.

Matt Parizeau

unread,
Oct 27, 2014, 1:17:12 PM10/27/14
to pdfnet-w...@googlegroups.com
Hi Richard,

I would recommend using a config file to do what you want. You can have it run by setting the config option to point to your file in the PDFTron.WebViewer constructor.
var myWebViewer = new PDFTron.WebViewer({
    config
: "config.js",
   
...
   
...
}, viewerElement);

Inside the config file I would have:
$(document).on('documentLoaded', function() {
    readerControl
.setVisibleTab(2);
    $
('#fullSearchBox').val('mysearchterm');
    $
('#fullSearchButton').trigger('click');
});

Matt Parizeau
Software Developer
PDFTron Systems Inc.
Reply all
Reply to author
Forward
0 new messages