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.
In the pdfjs library are some examples including the components example that renders a page and you can mark the text (https://github.com/mozilla/pdf.js/tree/master/examples/components).
But when I'm trying to use this code in my app I'm getting the error that PDFJS.DefaultTextLayerFactory()
is undefined. I include these three files:
<script src="lib/pdfviewer/pdf.js"></script>
<script src="lib/pdfviewer/pdf.worker.js"></script>
<script src="lib/pdfviewer/pdf_viewer.js"></script>
<script src="lib/pdfviewer/compatibility.js"></script>
What am I doing wrong? Why does PDFJS not know DefaultTextLayerFactory
?
Highlight selected text Select the text that you want to highlight. Go to Home and select the arrow next to Text Highlight Color. Select the color that you want.
Choose Tools > Note Type > Circle, Tools > Note Type > Box, Tools > Note Type > Highlight, Tools > Note Type > Underline, or Tools > Note Type > Strike Out. Select the text you want to highlight or region you want to circle. You can do this repeatedly.
I found the solution. I forgot to include viewer.js
How to search for terms you can find here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With