Text Search and Selection
ComPDFKit for Web offers developers an API for programmatic full-text search, as well as UI for searching and highlighting relevant matches. You can use the method below to search for content in PDFs with ComPDFKit for Web.
javascript
docViewer.search(value);| Name | Required | Type | Description |
|---|---|---|---|
| value | yes | string | The Searched Content |
If you only need to get the position of the search term, you can obtain it through the following API.
javascript
docViewer.searchInPage(value, pageNumber);The API will return an array of search results, each containing the page number, the position of the search term, and the content of the search term.
json
[{
"pageNum": 1,
"quads": [{
"left": 154.57814025878906,
"top": 211.6978759765625,
"right": 184.56173706054688,
"bottom": 229.4798583984375
}],
"content": " a sample PDF document that showc",
"pageSearchIndex": 0,
"searchValue": "PDF"
}]