AppendText

AppendText(TextFragment)

إلحاق جزء نصي بصفحة Pdf

public void AppendText(TextFragment textFragment)
معامليكتبوصف
textFragmentTextFragmentكائن جزء النص.

أمثلة

يوضح المثال كيفية إنشاء كائن جزء النص وتخصيص أجزاء النص وإلحاقه بصفحة Pdf.

Document doc = new Document(inFile);
Page page = (Page)doc.Pages[1];

// إنشاء جزء نصي
TextFragment tf = new TextFragment("main text");
tf.Position = new Position(100, 600);

// تعيين خصائص النص
tf.TextState.FontSize = 5;
tf.TextState.Font = FontRepository.FindFont("TimesNewRoman");
tf.TextState.BackgroundColor = Color.LightGray;
tf.TextState.ForegroundColor = Color.Red;

// إضافة جزء واحد إلى مجموعة أجزاء جزء النص
TextSegment segment2 = new TextSegment();
segment2.Text = "another segment";

tf.Segments.Add(segment2);

// إنشاء كائن TextBuilder
TextBuilder builder = new TextBuilder(page);

// إلحاق جزء النص بصفحة Pdf
builder.AppendText(tf);

// حفظ الوثيقة
doc.Save(outFile);

أنظر أيضا


AppendText(List<TextFragment>)

إلحاق قائمة بأجزاء النص بصفحة Pdf.

public void AppendText(List<TextFragment> textFragments)
معامليكتبوصف
textFragmentsList`1مجموعة من أجزاء النص

أنظر أيضا