This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/web/conversion/image-to-text.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. Convert image to text with JavaScript library | Nutrient SDK

You can convert images to text with Nutrient Web SDK.

Converting images to text is available when using Web SDK with Document Engine. For more information, refer to the operational mode guide.

First, make sure to open the image from Document Engine.

This feature requires the Image Documents component to be enabled in your license.

Next, detect the text in the image by running the performOcr operation:

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

This feature requires the OCR component to be enabled in your license.

Then you can extract the text using the NutrientViewer.Instance#textLinesForPageIndex method:

const textLines = await instance.textLineForPageIndex(0);

To log all text in the image on the console, you can then run:

textLines.forEach((l) => console.log(l.contents));

Other languages

You can extract text written in languages other than English using the language parameter:

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

Nutrient Web SDK 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