Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# .NET
How to Convert .tif file to .txt file in Windows application(.Net(C#))
Posted 4-Apr-13 20:59pm
Comments
Sandeep Mewara at 5-Apr-13 2:06am
   
Tried anything so far?
Prasad Khandekar at 5-Apr-13 2:46am
   
Hello Dheerendra,
 
Why not use any OCR software?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Path.ChangeExtension can be used to change the extention of Path string
 
EX:
String filePath = "E:\\WindowsPractice\\Class1.tif";
Path.ChangeExtension(filePath, ".txt");
 

To change the extention of the file physically:

File.Move(filePath, Path.ChangeExtension(filePath, ".txt"));
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hello Dheerendra,
 
Here is a small snippet based on ASPOSE OCR SDK.
//Create OcrEngine instance and assign image, language and image configuration
OcrEngine ocr = new OcrEngine();
ocr.Image = ImageStream.FromFile("YOUR IMAGE PATH");
ocr.Languages.AddLanguage(Language.Load("english"));
ocr.Config.NeedRotationCorrection = chkRotation.Checked;
ocr.Config.UseDefaultDictionaries = true;
//Set resource file name and extract OCR text
using (ocr.Resource = new FileStream(resourceFileName, FileMode.Open)) {
    if (ocr.Process()) {
        strText = ocr.Text.ToString();
    }
}
 
A more complete sample can be found on ASPOSE web site[^]. There is a freeware wrapper[^] available for Tesseract[^] OCR Library as well. Another alternative is to use MODI which is part of Microsoft Office.
 
Regards,
  Permalink  
Comments
Dheerendra Dwivedi at 8-Apr-13 8:08am
   
But how to Add OcrEngin in my Application
Prasad Khandekar at 8-Apr-13 8:42am
   
First you need to purchase ASPOSE OCR SDK or dowload the trial version. The link is given in the solution. Next you have to add reference to the Aspose OCR assembly.
 
1. Right-click the project's References node and select Add Reference from the menu.
2. In the Add Reference dialog, select the .NET tab
3. If you used an MSI installer to install Aspose.OCR, Aspose.OCR is listed in the top pane. Select Aspose.OCR and then click Select
4. If you downloaded and unpacked the DLL only, locate the Aspose.OCR.dll file using the Browse button
 
The getting started guide for Aspose.OCR Sdk is available here (http://www.aspose.com/docs/display/ocrnet/Getting%20Started)
 
Regards,
Dheerendra Dwivedi at 11-Apr-13 7:13am
   
mdoc.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, True, True)is giive me OCR Error
Prasad Khandekar at 11-Apr-13 8:00am
   
What's the error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 PIEBALDconsult 150
3 BillWoodruff 148
4 Jochen Arndt 135
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 5 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100