I tried to implement the @webstruck approach, but could not resolve the "PDFView is not defined" error. I end up deciding this way:
//Add this piece of code to webViewerInitialized function in viewer.js if ('search' in params) { searchPDF(params['search']); }
then changed his approach to this:
//New function in viewer.js function searchPDF(p_search_text) { var l_params = { query: p_search_text, phraseSearch: p_search_text }; webViewerFindFromUrlHash(l_params); }
In the HTML iframe, I added the term & search = and got the following:
<iframe id="htmlPDFViewer" style="width:100%; " frameBorder="0" src="../Scripts/pdfjs/web/viewer.html?file=../pdf/file.pdf&search=searchTerm" ></iframe>
Worked like a charm, all the words are highlighted!
Rafael araΓΊjo
source share