Integrate OCR into Web Scanning: 25 Projects in 25 Days

Posted on 2015-10-06 Greg

Select Source Start Scanning Saving OCRed PDF

As part of the LEAD Technologies 25th anniversary, we are creating 25 projects in 25 days to celebrate LEAD's depth of features and ease of use. Today's project comes from Daoud.

What it Does

This web application will scan documents and convert them to searchable PDF with OCR using LEADTOOLS Version 19.

Features Used

Development Progress Journal

Hello, my name is Daoud and I am going to update our HTML5 REST Services to use OCR on images scanned from our Web Scanning demo and save the OCR result to an image-over-text PDF file.

I am using LEADTOOLS Document Imaging Suite SDK v19 and developing with VS2010 with .NET 4.

I am going to update the EndDocument function of the UploadService.cs file in our Leadtools.RESTServices project. The source code for the REST services is in the Leadtools.RESTServices project and it is shipped along with our HTML5 demos' source code in the LEADTOOLS SDK. The source code for the original project can be found here:

[LEADTOOLS 19]\Examples\REST\Leadtools.RESTServices

The EndDocument function will append the scanned images to a single file, and if the user selects PDF as the output format, the service will perform OCR on the scanned images.

I used IOcrEngine interface to initialize an instance of the OCR engine and deal with the OCR engine.

Documentation: IOcrEngine

I used IOcrDocument interface to handle the OCR operation inputs and outputs:

Documentation: IOcrDocument

The scanned images are loaded to RasterImage object:

Documentation: RasterImage

I used PdfDocumentOptions class to set the PDF options of the resulting PDF:

Documentation: PdfDocumentOptions

When the client clicks on the "Save to File" button in our HTML5 Scan demo, the scanned images will be sent from the client-side to server-side where the UploadService will be used to create the output file. If the user selected PDF format when he clicked on the "Save to File" button, the service will add the pages to IOcrDocument object and perform OCR then save the result to Image-over-text PDF file and send it back to the client-side.

This application is done and done!  It took me a total of 2 hours to update our service, including testing and debugging.  Without the LEADTOOLS Document Imaging Suite SDK, I cannot even imagine how long a task like this would take.

Download the Project

The source code for this sample project can be downloaded from here.

LEADTOOLS Blog

LEADTOOLS Powered by Apryse,the Market Leading PDF SDK,All Rights Reserved