Read  PDF JS search text for more information.

PDF.js or pdf.js is a JavaScript library that renders Portable Document Format (PDF) files using the web standards-compliance HTML5 Canvas. The project is led by the Mozilla Foundation after Andreas Gal launched it (initially as an experiment) in 2011.

PDF.js can work as a part of a website or of a browser. Originally created as a Firefox extension, it is now included in Mozilla Firefox since 2012 (version 15) and is enabled by default since 2013 (version 19).

pdf js search text
How to search with pdf.js?

Here is the solution:

var container = document.getElementById('viewerContainer');
var viewer = document.getElementById('viewer');

var pdfViewer = new PDFViewer({ 
   container: container,
   viewer: viewer

$scope.pdfFindController = new PDFFindController({
   pdfViewer: pdfViewer


container.addEventListener('pagesinit', function () {
    pdfViewer.currentScaleValue = 'page-width';                            

PDFJS.getDocument(MY_PATH_TO_THE_PDF).then(function (pdfDocument) {

And for the search

$scope.pdfFindController.executeCommand('find', {
    caseSensitive: false, 
    findPrevious: undefined,
    highlightAll: true, 
    phraseSearch: true, 
    query: "myQuery"

If you don’t want to go through the trouble of coding to set up a PDF search then you can try a PDF search engine instead.


Create a PDF search engine

Searches related to pdf js search text

You may also like