How to select text using PDFJS?

I am creating an application that displays a PDF file among others. I need to implement a search function so that I can search for conditions in a pdf file. To display the file, I use PDFJS.

The pdfjs library provides some examples, including an example of components that displays the page, and you can mark the text ( https://github.com/mozilla/pdf.js/tree/master/examples/components ).

But when I try to use this code in my application, I get the error PDFJS.DefaultTextLayerFactory() 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 doesn't DefaultTextLayerFactory know DefaultTextLayerFactory ?

+2
source share
1 answer

I have found a solution. I forgot to enable viewer.js

How to find the conditions you can find here

+3
source

Source: https://habr.com/ru/post/1272482/


All Articles