すべてのテキストを抽出
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); | |
} | |
} |