I discovered that earlier versions of code that are used to extract texts using PDFJS no longer work with the recent version of PDFJS. Here are some previous versions
Extract text from pdf file using javascript
how to correctly extract text from a pdf using pdf.js
extract text from pdf in Javascript .
Does anyone have a current code that works?