PdfFocusCOCROptionseOCRMode Enumeration |
Represent OCR modes: Disable (default), All images, Automatic.
Namespace: SautinSoftAssembly: SautinSoft.PdfFocus (in SautinSoft.PdfFocus.dll) Version: 2024.8.6
Syntax Public Enumeration eOCRMode
Members Member name | Value | Description |
---|
Disabled | 0 |
Don't make OCR (optical recognizing) for images at all. The images will be placed into resulting document as is.
|
AllImages | 1 |
Perform the OCR (optical recognizing) for every image.
Note, the component will consider the every image as textual data scanned or photographed and try to recognize it.
In any case (successfully or failing) recognizing (OCR) the all images will NOT be placed in the resulting document.
|
Auto | 2 |
Perform the OCR (optical recognizing) for images that looks as scanned or photographed text.
Such images (after performing OCR) will be placed in the resulting document as text.
Other images will be placed in the resulting document as images.
|
Example Perform OCR using free Tesseract SDK in C#
using System.IO;
using SautinSoft;
using System;
namespace Example
{
class Program
{
static void Main(string[] args)
{
LoadScannedPdf();
}
static void LoadScannedPdf()
{
string inpFile = Path.GetFullPath(@"..\..\..\scan.pdf");
string outFile = "Result.docx";
PdfFocus f = new PdfFocus();
f.OCROptions.Mode = PdfFocus.COCROptions.eOCRMode.AllImages;
f.OpenPdf(inpFile);
bool result = false;
if (f.PageCount > 0)
{
result = f.ToWord(outFile) == 0;
}
if (result)
{
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outFile) { UseShellExecute = true });
}
else
Console.WriteLine("Conversion failed!");
}
}
}
Perform OCR using free Tesseract SDK in VB.Net
Imports System.IO
Imports SautinSoft
Imports System
Namespace Example
Friend Class Sample
Shared Sub Main(ByVal args() As String)
LoadScannedPdf()
End Sub
Private Shared Sub LoadScannedPdf()
Dim inpFile As String = Path.GetFullPath("..\..\..\scan.pdf")
Dim outFile As String = "Result.docx"
Dim f As New PdfFocus()
f.OCROptions.Mode = PdfFocus.COCROptions.eOCRMode.AllImages
f.OpenPdf(inpFile)
Dim result As Boolean = False
If f.PageCount > 0 Then
result = f.ToWord(outFile) = 0
End If
If result Then
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outFile) With {.UseShellExecute = True})
Else
Console.WriteLine("Conversion failed!")
End If
End Sub
End Class
End Namespace
See Also