PdfFocusOCROptions Property |
Set the properties to attach any OCR library.
Namespace: SautinSoftAssembly: SautinSoft.PdfFocus (in SautinSoft.PdfFocus.dll) Version: 2024.12.18
Syntax public PdfFocusCOCROptions OCROptions { get; set; }
Public Property OCROptions As PdfFocusCOCROptions
Get
Set
Property Value
PdfFocusCOCROptionsExample Perform OCR using free Nicomsoft 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(@"..\..\..\ARGW64125SX.pdf");
string outFile = "Result.docx";
PdfFocus f = new PdfFocus();
f.OCROptions.Mode = PdfFocus.COCROptions.eOCRMode.AllImages;
f.OCROptions.OcrResourcePath = @"..\..\..\tessdata";
f.OCROptions.OcrLanguage = "ron";
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 Nicomsoft 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("..\..\..\ARGW64125SX.pdf")
Dim outFile As String = "Result.docx"
Dim f As New PdfFocus()
f.OCROptions.Mode = PdfFocus.COCROptions.eOCRMode.AllImages
f.OCROptions.OcrResourcePath = "..\..\..\tessdata"
f.OCROptions.OcrLanguage = "ron"
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