This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Sunday, November 27, 2011 10:41:07 PM(UTC)
Groups: Registered
Posts: 6
I'm trying to save Searchable PDF from TIF format images after OCR.
I writed PdfDocumentOptions, ImageOverText = true.
But Result pdf image is not searchable.
I'm using 17.5 .net C#, Advantate OCR.
Could you please explain to me what is wrong ?
public void ThreadProc(object data)
{
ThreadData threadData = (ThreadData)data;
string strImageFilePath = threadData.strImageFilePath;
using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false))
{
try
{
string strModuleDirectory = String.Concat(m_strModuleDirectory, @"OcrAdvantageRuntime\");
ocrEngine.Startup(null, null, null, strModuleDirectory); //OcrAdvantageRuntime path
ocrEngine.LanguageManager.EnableLanguages(m_strLang); //"en"
CIniUtil clsIni = new CIniUtil();
string strPath = clsIni.getIniValue("ENVIR", "DstPath", threadData.strIniFilePath);
Directory.CreateDirectory(strPath);
string strFileName = Path.GetFileName(strImageFilePath);
string strDstImageFilePath = String.Concat(strPath, strFileName);
strDstImageFilePath = Path.ChangeExtension(strDstImageFilePath, "pdf");
DocumentWriter docWriter = ocrEngine.DocumentWriterInstance;
PdfDocumentOptions pdfOption = docWriter.GetOptions(DocumentFormat.Pdf) as PdfDocumentOptions;
pdfOption.ImageOverText = true;
pdfOption.AssemblyEnabled = true;
pdfOption.CopyEnabled = true;
pdfOption.EditEnabled = true;
pdfOption.Protected = false;
pdfOption.PageRestriction = DocumentPageRestriction.Relaxed;
docWriter.SetOptions(DocumentFormat.Pdf, pdfOption);
using (IOcrDocument ocrDocument = ocrEngine.DocumentManager.CreateDocument())
{
ocrDocument.Pages.AddPages(strImageFilePath, 1, -1, null);
ocrDocument.Pages.Recognize(null);
ocrDocument.Save(strDstImageFilePath, DocumentFormat.Pdf, null);
}
}
catch (Exception ex){}
finally{}
}
threadData.WaitHandle.Set();
} //ThreadProc
#2
Posted
:
Tuesday, November 29, 2011 1:35:38 PM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Hello,
Could you please tell me the file version of your Leadtools.Forms.DocumentWriters.dll?
#3
Posted
:
Tuesday, November 29, 2011 2:19:25 PM(UTC)
Groups: Registered
Posts: 6
The Version of Leadtools.Forms.DocumentWriters.dll is "17.5.0.5"
#4
Posted
:
Tuesday, November 29, 2011 3:53:35 PM(UTC)
Groups: Registered
Posts: 6
julia78 wrote:
The Version of Leadtools.Forms.DocumentWriters.dll is "17.5.0.5"
DotNet4
#5
Posted
:
Wednesday, November 30, 2011 12:19:09 AM(UTC)
Groups: Registered
Posts: 6
Debug Output of Debug/Release Mode is not searchable PDF.
Not debug mode (direct execution) is searchable PDF.
please why?
#6
Posted
:
Wednesday, November 30, 2011 10:14:21 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
The version you provided is the product version. I need to know the File Version.
The only issue I can think of is if different dlls are being loaded when you directly execute, apposed from when you run from the Visual studios debugger.
Are you familiar with process explorer?
You can test and see which DLLs are being loaded by your application at any time by using Process Explorer. This is a free program that is available from
http://technet.microsoft...sinternals/bb896653.aspx . Use this program and see what DLLs loaded when you run from the IDE as apposed to running from direct execution.
To see the DLLs, click on View -> Lower Pane View -> DLLs.
To see the path of the DLLs, click on View -> Select Columns, go to the DLL tab, and select the Path checkbox.
#7
Posted
:
Wednesday, November 30, 2011 3:47:54 PM(UTC)
Groups: Registered
Posts: 6
Hello! First, thank you for your response.
I have used process explorer but directory of Leadstools dlls is same.
File version of Leadtools.Forms.Document.dll is 17.5.0.5, Product Version is 17.5.4.0 and Runtime version is v4.0.30319.
What can i do for checking difference result between debug mode and not?
#8
Posted
:
Friday, December 2, 2011 7:17:07 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Try comparing the files being loaded by the process when run from the IDE as apposed to the process when your running from direct Execution.
The application is executing the same code regardless. The only thing I can think of would be if VS is loading different assemblies.
Another test would be to try this with the MainOCR Demo project.
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.