Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 20, 2012 05:57 AM by catherine sea
Mar 30, 2012 06:25 AM|LINK
How to convert scanned image to any word doc or aiken format in c#
Mar 30, 2012 06:38 AM|LINK
I m also try this way - How to generate and image form given text or how to convert text in to image? Dotnet framework provides System.Drawing and System.Drawing.Graphics class which helps us to generate image from text or convert text into image. Below is the code,
private Bitmap CreateBitmapImage(string sImageText)
3: Bitmap objBmpImage = new Bitmap(1, 1);
5: int intWidth = 0;
6: int intHeight = 0;
8: // Create the Font object for the image text drawing.
9: Font objFont = new Font("Arial", 20, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel);
11: // Create a graphics object to measure the text's width and height.
12: Graphics objGraphics = Graphics.FromImage(objBmpImage);
14: // This is where the bitmap size is determined.
15: intWidth = (int)objGraphics.MeasureString(sImageText, objFont).Width;
16: intHeight = (int)objGraphics.MeasureString(sImageText, objFont).Height;
18: // Create the bmpImage again with the correct size for the text and font.
19: objBmpImage = new Bitmap(objBmpImage, new Size(intWidth, intHeight));
21: // Add the colors to the new bitmap.
22: objGraphics = Graphics.FromImage(objBmpImage);
24: // Set Background color
26: objGraphics.SmoothingMode = SmoothingMode.AntiAlias;
27: objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
28: objGraphics.DrawString(sImageText, objFont, new SolidBrush(Color.FromArgb(102, 102, 102)), 0, 0);
31: return (objBmpImage);
Mar 30, 2012 06:55 AM|LINK
well that's a lot of trouble without using third party library. so here is the library that might help you out:
the technique that is used to convert the drawn text on images to real text is known as OCR(optical character recognition). now to do OCR your image should be clean, meaning it should be scanned straight and it should have a good contrast. the contrast can
be manipulated by using System.Drawing namespace but scanning the document in a correct way is not something you can control.
to generate the word document you can use another third party library:
Apr 02, 2012 08:34 AM|LINK
Its not working. I wanna convert scanned image(which contains text) to word document.
Apr 02, 2012 08:57 AM|LINK
Have you try the Hj's suggestion?
I think it's hard and it's not asp.net tech.
You should learn some OCR tech.
Apr 03, 2012 08:01 AM|LINK
yeah but using OCR open source is also not so easy.I used in my code but its not working.
Getting an error like Application class is having no any constructors and im unable to solve it i.
Aug 20, 2012 05:57 AM|LINK
True. It's not that easy to use OCR open source. What kind of error messages did you get when doing the OCR?
Also, have you ever considered using a third-party OCR sdk, self-designed or packaged based on the open source? Any of the options will make the coding much eaiser.
OCR SDK is based on the Tesseract OCR engine. You can check it out if you are interested in.