Convert Scanned PDFs to Searchable PDFs Using JavaScript

You can convert scanned documents to searchable PDFs if you use PSPDFKit for Web Server-Backed[].

To perform the conversion, first open the document from PSPDFKit Server, and then apply the performOcr document operation:

await instance.applyOperations([
  { type: "performOcr", language: "english", pageIndexes: "all" }
]);

This will detect all English text in the document and make it searchable.

ℹ️ Note: This feature requires the OCR component to be enabled in your license.

Other Languages

If your scanned document is written in a language other than English, you can make it searchable by modifying the language parameter. For example, to convert the document to Spanish, run:

await instance.applyOperations([
  { type: "performOcr", language: "spanish", pageIndexes: "all" }
]);

PSPDFKit for Web supports the following languages:

  • Croatian

  • Czech

  • Danish

  • Dutch

  • English

  • Finnish

  • French

  • German

  • Indonesian

  • Italian

  • Malay

  • Norwegian

  • Polish

  • Portuguese

  • Serbian

  • Slovak

  • Slovenian

  • Spanish

  • Swedish

  • Turkish

  • Welsh