如何使用wndows表单c#.net将图像格式转换为文本格式 [英] How to convert image format to text format using wndows forms c#.net

查看:99
本文介绍了如何使用wndows表单c#.net将图像格式转换为文本格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何了解以下主题





嗨每一个,



Iam尝试将图像格式PDF页面转换为文本格式,因为复制文本。

但是我尝试下面的代码,我试过。请帮帮我任何一个



我尝试过:



how to new to below topic


Hi Every one,

Iam try to convert image format PDF page to text format because of copy the text.
But i try to below code which i tried. please help me any one

What I have tried:

 byte[] imageArray = System.IO.File.ReadAllBytes("d:\\Source.doc");
           string base64ImageRepresentation = Convert.ToBase64String(imageArray);
           string result = System.Text.Encoding.UTF8.GetString(imageArray);
using (StreamWriter writer = new StreamWriter("d:\\Target.txt", true))
           {
               writer.Write(base64ImageRepresentation);
               writer.Flush();
               writer.Close();
           }

推荐答案

请尝试使用此示例中提到的步骤。



转换PDF到C#中的文字 [ ^ ]
Please try to use the steps mentioned below in this sample.

Converting PDF to Text in C#[^]


首先,您正在读取非PDF文件的.doc文件。其次,你不能以这种方式阅读doc文件,并希望它以文本形式出现。您需要使用 Microsoft.Office.Interop.Word命名空间() [ ^ ]解释MS Word文件。
For a start you are reading a .doc file which is not PDF. And secondly you cannot read a doc file in that way and expect it to come out as text. You need to use the Microsoft.Office.Interop.Word namespace ()[^] to interpret MS Word files.


这篇关于如何使用wndows表单c#.net将图像格式转换为文本格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆