The Apryse Summer 2026 Release: OUT NOW

Home

All Blogs

Unleashing The Power of OCR with JavaScript

Published January 22, 2025

Updated August 05, 2026

Read time

4 min

email
linkedIn
twitter
link

Unleashing The Power of OCR with JavaScript

Sanity Image

Garry Klooesterman

Senior Technical Content Creator

Sanity Image

Summary: This blog provides a guide for developers on how to extract text from images in PDFs or image-based PDFs using OCR in JavaScript. Apryse OCR SDK empowers developers to adjust their OCR solutions to address the unique challenges and requirements of the business needs.

Introduction

Copied to clipboard

If you’ve developed apps for the Web, chances are you already have a good grasp of JavaScript. As a beginner-friendly, versatile, full-featured scripting language, along with many other advantages, it’s easy to understand why JavaScript is currently one of the most popular programming languages.

In this blog, we’ll explore using JavaScript to implement a solution for a common challenge businesses face in today’s world; unlocking the information trapped in documents. Slow, inefficient, and error prone manual entry comes with higher costs and can easily drown a business. This is where Optical Character Recognition (OCR) technology saves the day.

Whether you’re transcribing patient records, verifying document authenticity, or automating data entry for supply chain management, the versatility of OCR technology and ability to streamline processes, improve efficiency, and unlock valuable insights makes it a critical tool across various industries.

Apryse OCR SDK: Your powerful JavaScript solution

Copied to clipboard

Apryse OCR SDK provides a comprehensive solution offering seamless integration, scalability, robust security, and exceptional accuracy for printed documents. If you are working with handwritten documents then you can extract data from those using the ICR SDK.

Key Features

  • Handles various document types, including tables, multiple languages, and different text orientations.
  • Automatically enhances image quality, leading to more accurate image recognition.
  • Efficiently handles high-volume workflows.
  • A server-based solution, keeping your sensitive material protected.
  • Easily integrated into existing systems and server environments.
  • Can be fine-tuned for optimal performance by adjusting processing parameters.

Apryse OCR SDK empowers developers to adjust their OCR solutions to address the unique challenges and requirements of the business needs.

By leveraging the power of Apryse OCR SDK, your business can realize such benefits as reduced cost, increased efficiency, improved accessibility, customized data output, and more.

OCR Engines

Copied to clipboard

Apryse v12 offers three OCR enginesto add advanced text extraction capabilities to your applications on Windows, Linux and macOS.

Default OCR Engine: Uses Deep Learning Neural Networks to extract text for more than 40 Latin-alphabet, 30 Cyrillic, 13 Devanagari and four CJK languages, plus Arabic, Greek, Thai and many others. It offers improved accuracy on a wide range of real-world documents, even those from low-quality scans or with complex layouts.

Alternative OCR Engine: Powered by LEADTOOLS technology, this was the default OCR engine in the Apryse v11 release, and offers support for English, French, German, Italian, Spanish and Russian.

IRIS OCR Module: The IRIS OCR Module, based on the IRIS iDRS engine, may provide better results in certain situations, such as processing items with multiple disconnected text snippets on a page, for example, magazine covers or CAD documents. The IRIS module is licensed separately from the standard Apryse OCR module and supports the six languages available with the Alternative OCR engine, plus CJK.

For this blog, we’ll focus on setting up the default OCR module to process an image or image-based PDF.

Getting started with Apryse OCR SDK

Copied to clipboard

The Apryse OCR module adds functionality into the Apryse SDK to process an image or image-based PDF and create a PDF that is searchable with selectable text. The module can be used with a number of programming languages, such as C#, C++, Java, Python, and more. For this example, we’ll use JavaScript.

Implementing the OCR module using JavaScript is incredibly easy and requires minimal code.

Step 2: Now let’s use OCR to make a searchable PDF by adding invisible text to an image or an image-based PDF using the following code:

PDFNet needs to be initialized with a license key before it is used, and should be terminated when you have finished with it. That has not been included here so that you can focus on the OCR specific code.

For an image:

For an image-based PDF:

See the full code sample with examples for various scenarios.

Keep your license key confidential
License keys are uniquely generated and strictly confidential. Don't publish or store them in any public location, including public GitHub repositories.
You can get a trial license key for testing purposes, but you will need a commercial license in a production environment.

Input Resolution

Copied to clipboard

Adjusting the input image resolution can sometimes provide better results. Use the following code to manually set the DPI:

// Manually override DPI
opts.addDPI(300);

Language Options

Copied to clipboard

The Apryse OCR module supports many languages and, with some limitations, you can use multiple languages when processing a document.

Other Options

Copied to clipboard

In addition to processing an image or PDF as we did earlier, you can apply raw OCR output (text and metadata in JSON or XML format) to the input document. See the documentation for more details and options.

Conclusion

Copied to clipboard

The Apryse OCR SDK brings a powerful OCR to your JavaScript projects with seamless integration to effortlessly extract text, even for documents with multiple languages or complex layout. With the power of Apryse OCR SDK in your JavaScript projects, you can decipher text from various languages, unlock insights from images or image-based PDFs, and access a universe of information locked in documents. With Apryse OCR, process anything from historical archives to your latest research papers, boosting productivity, and optimizing your business potential.

Want to see Apryse OCR & ICR SDK in action? Check out a demo now or contact our sales team.

Need help? Join our Support community for support and discussions.