AppendText

AppendText(TextFragment)

Agrega un fragmento de texto a la página PDF

public void AppendText(TextFragment textFragment)
ParámetroEscribeDescripción
textFragmentTextFragmentObjeto de fragmento de texto.

Ejemplos

El ejemplo muestra cómo crear un objeto de fragmento de texto, personalizar sus segmentos de texto y agregarlo a la página PDF.

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

// crea un fragmento de texto
TextFragment tf = new TextFragment("main text");
tf.Position = new Position(100, 600);

// establecer sus propiedades de texto
tf.TextState.FontSize = 5;
tf.TextState.Font = FontRepository.FindFont("TimesNewRoman");
tf.TextState.BackgroundColor = Color.LightGray;
tf.TextState.ForegroundColor = Color.Red;

// agregar un segmento más a la colección Segmentos del fragmento de texto
TextSegment segment2 = new TextSegment();
segment2.Text = "another segment";

tf.Segments.Add(segment2);

// crea el objeto TextBuilder
TextBuilder builder = new TextBuilder(page);

// agregar el fragmento de texto a la página PDF
builder.AppendText(tf);

//guardar documento
doc.Save(outFile);

Ver también


AppendText(List<TextFragment>)

Agrega una lista de fragmentos de texto a la página PDF.

public void AppendText(List<TextFragment> textFragments)
ParámetroEscribeDescripción
textFragmentsList`1colección de fragmentos de texto

Ver también