Class TextDevice
محتويات
[
يخفي
]TextDevice class
تمثل فئة لتحويل صفحات مستند PDF إلى نص.
public sealed class TextDevice : PageDevice
Constructors
| Name | Description |
|---|---|
| TextDevice() | يقوم بتهيئة مثيل جديد من TextDevice مع وضع تنسيق النص الخام وترميز النص Unicode. |
| TextDevice(Encoding) | يقوم بتهيئة مثيل جديد من TextDevice للترميز المحدد. |
| TextDevice(TextExtractionOptions) | يقوم بتهيئة مثيل جديد من TextDevice مع خيارات استخراج النص. |
| TextDevice(TextExtractionOptions, Encoding) | يقوم بتهيئة مثيل جديد من TextDevice للترميز المحدد مع خيارات استخراج النص. |
Properties
| Name | Description |
|---|---|
| Encoding { get; set; } | يحصل أو يحدد ترميز النص المستخرج. |
| ExtractionOptions { get; set; } | يحصل أو يحدد خيارات استخراج النص. |
Methods
| Name | Description |
|---|---|
| override Process(Page, Stream) | تحويل الصفحة وحفظها كتيار نص. |
| Process(Page, string) | يقوم بإجراء بعض العمليات على الصفحة المعطاة ويحفظ النتائج في الملف. |
Remarks
يستخدم كائن TextDevice بشكل أساسي لاستخراج النص من صفحة PDF.
Examples
توضح المثال كيفية استخراج النص من الصفحة الأولى لمستند PDF.
Document doc = new Document(inFile);
string extractedText;
using (MemoryStream ms = new MemoryStream())
{
// create text device
TextDevice device = new TextDevice();
// convert the page and save text to the stream
device.Process(doc.Pages[1], ms);
// use the extracted text
ms.Close();
extractedText = Encoding.Unicode.GetString(ms.ToArray());
}
See Also
- class PageDevice
- namespace Aspose.Pdf.Devices
- assembly Aspose.PDF