모든 텍스트 추출하기
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); | |
} | |
} |