LEADTOOLS Support
Document
Document SDK Examples
HOW TO: Convert a Non-Searchable PDF to a Searchable PDF
#1
Posted
:
Tuesday, March 13, 2018 11:15:52 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 89
Was thanked: 4 time(s) in 4 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();
Edited by user Tuesday, September 11, 2018 2:12:53 PM(UTC)
| Reason: Not specified
Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK Examples
HOW TO: Convert a Non-Searchable PDF to a Searchable PDF
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.