Extrahovat veškerý text
Contents
[
Hide
]Jak extrahovat veškerý text
Problém: Jak extrahovat veškerý text.
Tipy: K tomu můžete použít metodu GetStrings, která vám umožní získat celý text.
Poznámka: Můžete extrahovat veškerý text ze spodního výkresu. Níže je příklad extrahování veškerého textu. Jsou připojeny výstupní soubory konzole (ExtractTextResult.bmp) a zdrojový soubor (ExtractText.dwg).
Příklad:
This file contains 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); | |
} | |
} |