Trying to auto-search with pdfjs, (and having hard time with the docs..)
THIS WORKS:
<input type="button" value="click-me" onclick="searchPDF('cpu');" />
THIS DOESN'T (jquery running ok)
$(document).ready(function() {
searchPDF('cpu');
});
HOW DO SUSPEND EXECUTION UNTIL THE PDF IS PARSED? (OR WHY ISN'T IT WORKING)
MODIFIED viewer.html (thanks to PDF.js - Using search function on embedded PDF )
// search with PDF.js
function searchPDF(td_text) {
//PDFView.findBar.open();
$('#findInput').val(td_text);
$("#tableDiv").focus();
PDFView.findBar.findNextButton.click();
var event = document.createEvent('CustomEvent');
event.initCustomEvent('find', true, true, {
query: td_text,
caseSensitive: $("#findMatchCase").prop('checked'),
highlightAll: $("#findHighlightAll").prop('checked'),
findPrevious: undefined
});
return event;