I embedded a PDF using PDF.js with the iframe src=viewer.html?file=...
tag. I\'m using PDF.js and its viewer.html as it already provides a search function that
I tried to implement @webstruck's approach but couldn't resolve "PDFView is not defined" error. I end up resolving like this:
//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 the iframe I added the &search=term and got like this:
Worked like a charm, all words highlighted!