Извлечение всего текста
Contents
[
Hide
]Как извлечь весь текст
Проблема: Как извлечь весь текст.
Советы: Для этого вы можете использовать метод GetStrings, который позволяет получить весь текст.
Примечание: Вы можете извлечь весь текст из основного рисования. Ниже приведен пример извлечения всего текста. Прикреплены результаты консольного вывода (ExtractTextResult.bmp) и исходный файл (ExtractText.dwg).
Пример:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string fileName = "ExtractText"; | |
string file = string.Format("{0}.dwg", fileName); | |
using (FileStream inStream = new FileStream(file, FileMode.Open)) | |
using (CadImage image = (CadImage)Image.Load(inStream)) | |
{ | |
foreach (string s in image.GetStrings()) | |
{ | |
Console.WriteLine(s); | |
} | |
} |