Convert Scanned PDFs to Searchable PDFs Using JavaScript

You can convert scanned documents to searchable PDFs with PSPDFKit for Web.

Information

Converting scanned documents to a searchable PDF is available when using the Web SDK with Document Engine in server-backed operational mode.

To perform the conversion, first open the document from Document Engine, 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