Extract all text
Contents
[
Hide
]How to extract all text
Issue: How to extract all text.
Tips: To do this, you can use the GetStrings method, which allows you to get the entire text.
Note: You can extract all text from underlying drawing. Below is an example of extract all text. Attached are the result of console output (ExtractTextResult.bmp) and the source file (ExtractText.dwg).
Example:
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); | |
} | |
} |