ReplaceText
محتويات
[
يخفي
]ReplaceText(string, int, string, TextState)
يستبدل النص في ملف PDF بالصفحة المحددة.TextState
يمكن تحديد الكائن (عائلة الخط ، اللون) لاستبدال النص.
public bool ReplaceText(string srcString, int thePage, string destString, TextState textState)
معامل | يكتب | وصف |
---|---|---|
srcString | String | السلسلة المراد استبدالها. |
thePage | Int32 | رقم الصفحة (0 تعني “كل الصفحات”). |
destString | String | السلسلة المستبدلة. |
textState | TextState | حالة النص (لون النص ، الخط ، إلخ). |
قيمة الإرجاع
يعود صحيحا إذا تم الاستبدال.
أمثلة
يوضح المثال كيفية استبدال النص في الصفحة الأولى من مستند PDF وتعيينهTextState
خصائص النص للنص الجديد.
// فتح المستند
Document doc = new Document(inFile);
// إنشاء الخط ووضع علامة عليه ليتم تضمينه
Aspose.Pdf.Text.Font font = FontRepository.FindFont("Courier New");
font.IsEmbedded = true;
// إنشاء كائن PdfContentEditor لتحرير النص
PdfContentEditor editor = new PdfContentEditor();
editor.BindPdf(doc);
// إنشاء كائن حالة النص
TextState textState = new TextState();
textState.Font = font;
textState.FontSize = 17;
textState.FontStyle = FontStyle.Bold | FontStyle.Italic;
textState.ForegroundColor = Color.Red;
// تغيير النص بالخط المحدد
editor.ReplaceText("hello world", 1, "hi world", textState);
// حفظ الوثيقة
doc.Save(outFile);
أنظر أيضا
- class TextState
- class PdfContentEditor
- مساحة الاسم Aspose.Pdf.Facades
- المجسم Aspose.PDF
ReplaceText(string, string)
يستبدل النص في ملف PDF .
public bool ReplaceText(string srcString, string destString)
معامل | يكتب | وصف |
---|---|---|
srcString | String | السلسلة المراد استبدالها. |
destString | String | استبدال السلسلة. |
قيمة الإرجاع
يعود صحيحا إذا تم الاستبدال.
أمثلة
يوضح المثال كيفية استبدال النص في مستند PDF.
// فتح المستند
Document doc = new Document(inFile);
// إنشاء كائن PdfContentEditor لتحرير النص
PdfContentEditor editor = new PdfContentEditor();
editor.BindPdf(doc);
// تغيير النص
editor.ReplaceText("hello world", "hi world");
// حفظ الوثيقة
doc.Save(outFile);
أنظر أيضا
- class PdfContentEditor
- مساحة الاسم Aspose.Pdf.Facades
- المجسم Aspose.PDF
ReplaceText(string, int, string)
يستبدل النص في ملف PDF بالصفحة المحددة.
public bool ReplaceText(string srcString, int thePage, string destString)
معامل | يكتب | وصف |
---|---|---|
srcString | String | اللدغة المراد استبدالها. |
thePage | Int32 | رقم الصفحة (0 لجميع الصفحات) |
destString | String | استبدال السلسلة. |
قيمة الإرجاع
يعود صحيحا إذا تم الاستبدال.
أمثلة
يوضح المثال كيفية استبدال النص في مستند PDF على الصفحة المحددة.
// فتح المستند
Document doc = new Document(inFile);
// إنشاء كائن PdfContentEditor لتحرير النص
PdfContentEditor editor = new PdfContentEditor();
editor.BindPdf(doc);
// تغيير النص
editor.ReplaceText("hello world", 1, "hi world");
// حفظ الوثيقة
doc.Save(outFile);
أنظر أيضا
- class PdfContentEditor
- مساحة الاسم Aspose.Pdf.Facades
- المجسم Aspose.PDF
ReplaceText(string, string, TextState)
يستبدل النص في ملف PDF باستخدام المحددTextState
الكائن .
public bool ReplaceText(string srcString, string destString, TextState textState)
معامل | يكتب | وصف |
---|---|---|
srcString | String | سيتم استبدال السلسلة |
destString | String | استبدال السلسلة |
textState | TextState | حالة النص (لون النص ، الخط ، إلخ) |
قيمة الإرجاع
يعود صحيحا إذا تم الاستبدال.
أمثلة
يوضح المثال كيفية استبدال النص والتعيينTextState
خصائص النص للنص الجديد.
// فتح المستند
Document doc = new Document(inFile);
// إنشاء الخط ووضع علامة عليه ليتم تضمينه
Aspose.Pdf.Text.Font font = FontRepository.FindFont("Courier New");
font.IsEmbedded = true;
// إنشاء كائن PdfContentEditor لتحرير النص
PdfContentEditor editor = new PdfContentEditor();
editor.BindPdf(doc);
// إنشاء كائن حالة النص
TextState textState = new TextState();
textState.Font = font;
textState.FontStyle = FontStyle.Bold | FontStyle.Italic;
// تغيير النص بالخط المحدد
editor.ReplaceText("hello world", "hi world", textState);
// حفظ الوثيقة
doc.Save(outFile);
أنظر أيضا
- class TextState
- class PdfContentEditor
- مساحة الاسم Aspose.Pdf.Facades
- المجسم Aspose.PDF
ReplaceText(string, string, int)
يستبدل النص في ملف PDF ويعين حجم الخط.
public bool ReplaceText(string srcString, string destString, int fontSize)
معامل | يكتب | وصف |
---|---|---|
srcString | String | سيتم استبدال السلسلة. |
destString | String | استبدال السلسلة. |
fontSize | Int32 | حجم الخط. |
قيمة الإرجاع
يعود صحيحا إذا تم الاستبدال.
أمثلة
يوضح المثال كيفية استبدال النص وتعيين حجم الخط للنص الجديد.
// فتح المستند
Document doc = new Document(inFile);
// إنشاء الخط ووضع علامة عليه ليتم تضمينه
Aspose.Pdf.Text.Font font = FontRepository.FindFont("Courier New");
font.IsEmbedded = true;
// إنشاء كائن PdfContentEditor لتحرير النص
PdfContentEditor editor = new PdfContentEditor();
editor.BindPdf(doc);
// تغيير النص بالخط المحدد
editor.ReplaceText("hello world", "hi world", 14);
// حفظ الوثيقة
doc.Save(outFile);
أنظر أيضا
- class PdfContentEditor
- مساحة الاسم Aspose.Pdf.Facades
- المجسم Aspose.PDF