# Searching Feature is not working on some file

**URL:** <https://pdfjs.community/t/searching-feature-is-not-working-on-some-file/3126>\
**Category:** Technical Support\
**Created:** [February 12, 2024, 8:04am UTC](https://pdfjs.community/t/searching-feature-is-not-working-on-some-file/3126 "2024-02-12T08:04:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aungkolatt2504](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@aungkolatt2504](https://pdfjs.community/u/aungkolatt2504)\
**Post date:** [February 12, 2024, 8:04am UTC](https://pdfjs.community/t/searching-feature-is-not-working-on-some-file/3126/1 "2024-02-12T08:04:58Z")

</div>

**Which product are you using?**  
PDF.js Express Viewer

**PDF.js Express Version**  
8.7.4  
**Detailed description of issue**  
Searching on PDF is not working on some pdf. It is tested on small file size, large file size and Pages are like 6 and 465±40.

**Expected behaviour**  
Show the result of search on every file.

**Does your issue happen with every document, or just one?**  
Some Document

**Link to document**  
Clean Code “Robert Cecil Martin”

**Code snippet**  
import WebViewer from ‘@pdftron/pdfjs-express’  
window.pdfViewerInit = function (element) {  
let file = element.getAttribute(‘src’);  
const url = new URL(file);  
WebViewer({  
path: ‘/public’, // point to where the files you copied are served from  
disabledElements: url.searchParams.get(‘download’) == “true” ? : [  
‘downloadButton’,  
‘printButton’,  
‘printModal’  
],  
initialDoc: file  
}, element).then((instance) =\> {  
const { documentViewer } = instance.Core;

```
	// search can only be performed after a document is loaded
	documentViewer.addEventListener('documentLoaded', () => {
	})
})

```

}

---

<div class="post-metadata">

**Author:** ![ejohnson](https://avatars.discourse-cdn.com/v4/letter/e/a3d4f5/32.png) [@ejohnson](https://pdfjs.community/u/ejohnson)\
**Post date:** [February 12, 2024, 3:40pm UTC](https://pdfjs.community/t/searching-feature-is-not-working-on-some-file/3126/2 "2024-02-12T15:40:33Z")

</div>

Thank you for posting the incident to our forum. We will provide you with an update as soon as possible.

---

<div class="post-metadata">

**Author:** ![darian.chen](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@darian.chen](https://pdfjs.community/u/darian.chen)\
**Post date:** [February 12, 2024, 6:04pm UTC](https://pdfjs.community/t/searching-feature-is-not-working-on-some-file/3126/3 "2024-02-12T18:04:07Z")

</div>

Hi there,

Do you have a link to a file that the search is not working on? How are you performing the search? it looks like you aren’t doing it programmatically, is that correct?

Best Regards,  
Darian

---

<div class="post-metadata">

**Author:** ![aungkolatt2504](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@aungkolatt2504](https://pdfjs.community/u/aungkolatt2504)\
**Post date:** [February 13, 2024, 3:55pm UTC](https://pdfjs.community/t/searching-feature-is-not-working-on-some-file/3126/4 "2024-02-13T15:55:10Z")

</div>

Actually, I did test it both way.  
This File is not work  
[simple.pdf](https://pdfjs.community/uploads/short-url/ybTprU4AZSlxKl8MoHaqSWLGFbj.pdf) (615.1 KB)  
Demo File is work  
[demo.pdf](https://pdfjs.community/uploads/short-url/wRCITvfBQqhUh7e5bcKXiSIhpHj.pdf) (634.7 KB)

---

<div class="post-metadata">

**Author:** ![darian.chen](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@darian.chen](https://pdfjs.community/u/darian.chen)\
**Post date:** [February 13, 2024, 6:40pm UTC](https://pdfjs.community/t/searching-feature-is-not-working-on-some-file/3126/5 "2024-02-13T18:40:49Z")

</div>

Hi there,

Are you able to search this PDF using our demo site? [PDF.js Viewer Demo | PDF.js Express](https://pdfjs.express/demo)

I was not able to reproduce this issue. On our demo site I was able to search this PDF for the term “coder”.

 ![Screenshot 2024-02-13 at 1.36.23 PM](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/2X/8/8cf5c907bbfc03f3a94add6d2ee5024d50c60892.jpeg)

I also tried searching “coder” in Adobe Acrobat and I found 14 results as well.

Could you provide the code you are using to search?

Best Regards,  
Darian

---

<div class="post-metadata">

**Author:** ![aungkolatt2504](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@aungkolatt2504](https://pdfjs.community/u/aungkolatt2504)\
**Post date:** [February 14, 2024, 2:09am UTC](https://pdfjs.community/t/searching-feature-is-not-working-on-some-file/3126/6 "2024-02-14T02:09:17Z")

</div>

I sincerely appreciate your assistance, although I realize I may have taken up more of your time than intended. Thank you for your patience. I will endeavor to resolve the matter on my own. Thank you again.
