How to highlight text with PDFJS?
<p>I'm creating an app that shows a PDF file among others. I need to implement a search functionality so that I can search for terms in the pdf file. To display the file I'm using PDFJS. </p>

<p>In the pdfjs library are some examples including the components example that renders a page and you can mark the text (<a href="https://github.com/mozilla/pdf.js/tree/master/examples/components" rel="noreferrer">https://github.com/mozilla/pdf.js/tree/master/examples/components</a>). </p>

<p>But when I'm trying to use this code in my app I'm getting the error that <code>PDFJS.DefaultTextLayerFactory()</code> is undefined. I include these three files:</p>

<pre><code>&lt;script src="lib/pdfviewer/pdf.js"&gt;&lt;/script&gt;
&lt;script src="lib/pdfviewer/pdf.worker.js"&gt;&lt;/script&gt;
&lt;script src="lib/pdfviewer/pdf_viewer.js"&gt;&lt;/script&gt;
&lt;script src="lib/pdfviewer/compatibility.js"&gt;&lt;/script&gt;
</code></pre>

<p>What am I doing wrong? Why does PDFJS not know <code>DefaultTextLayerFactory</code>?</p>