Dear Sir,
How can I allow the pdf viewer jump to the specific page after search?
The pdfViewer.textSearchModule.searchText(text) function is working perfectly and I can see the search text is being highlighted but how can I let the viewer jump to that page?
I try to use pdfViewer.navigation.goToLastPage() and pdfViewer.navigation.goToPage(pageno); but it always go back to p
function loadPdf() {
var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0];
var filename = document.getElementById('txtfilename').value;
var text = document.getElementById('txtsearchstring').value;
ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.TextSearch,ej.pdfviewer.navigation);
pdfViewer.serviceUrl = '/api/PdfViewer';
pdfViewer.load(filename, null);
pdfViewer.textSearchModule.searchText(text);
pdfViewer.navigation.goToLastPage();
}
Regards,
WK
Besides, does DocumentEditor available for these two functions as well?
If yes, could you please provide me with the command (search and navigate to the target page)?
|
<button onclick="loadPdf()">Load PDF</button>
<ejs-pdfviewer id="pdfviewer" style="height:600px" serviceUrl="/api/PdfViewer" documentPath="PDF_Succinctly.pdf" enableNavigation="true"></ejs-pdfviewer>
<script>
function loadPdf() {
var pdfViewer = document.getElementById('pdfviewer').ej2_instances[0];
var text = "PDF";
pdfViewer.textSearchModule.searchText(text);
//pdfViewer.navigation.goToLastPage();
pdfViewer.navigation.goToPage(12);
}
</script> |
|
documenteditor.search.find('Some text', 'None');
//// Give page number in parameter
documenteditor.scrollToPage(2);
|