Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, March 13, 2018 11:20:52 AM(UTC)
Christopher Thompson

Groups: Tech Support, Administrators
Posts: 60

Was thanked: 2 time(s) in 2 post(s)

In the Example code below we show how to use the LEAD OCR engine to convert a non-searchable PDF to a searchable PDF.

This is a very simple process as outlined below:

Establish the Input and Output file paths.
Create and start the OCR engine.
Recognize the document and save.

At the bottom of this post is a functioning v20 C# project available for download, that includes a LEADTOOLS test file for converting.

C#
Code:

            string inFile = @"PATH TO NON-SEARCHABLE PDF";
            string outFile = @"OUTPUT PATH";

            using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false))
            {
                ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime");

                using (IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument())
                {
                    ocrDocument.Pages.AddPages(inFile, 1, -1, null);
                    ocrDocument.Pages.AutoZone(null);
                    ocrDocument.Pages.Recognize(null);

                    ocrDocument.Save(outFile, DocumentFormat.Pdf, null);
                    ocrDocument.Dispose();
                }
            }
            Console.ReadLine();



File Attachment(s):
convertPdfSearchable_20.zip (548kb) downloaded 61 time(s).

Edited by user Tuesday, September 11, 2018 2:17:53 PM(UTC)  | Reason: Not specified

Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2019, Yet Another Forum.NET
This page was generated in 0.068 seconds.