OK, can u help me out I am having one more doubt.
I am adding 2 text at the same time with for loop, my label variavle is having (text1,text2)
but while doing so its saving only text2 in my pdf, My requirement is that how I can create ( TextFragment textFragmentadd = new TextFragment(label[i])
dynamically for the first and second Text.
Example:
TextFragment textFragmentadd= new TextFragment(“Hi!”);
textFragmentadd.Position = new Position(20, 600-i);
// Set text properties
textFragmentadd.TextState.FontSize = 12;
textFragmentadd.TextState.Font = FontRepository.FindFont(“TimesNewRoman”);
textFragmentadd.TextState.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray);
textFragmentadd.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Red);
// Append the text fragment to the PDF page
textBuilderadd.AppendText(textFragmentadd);
.
.
.
.
TextFragment n = new TextFragment("n");
n .Position = new Position(20, 600-i);
// Set text properties
n .TextState.FontSize = 12;
n .TextState.Font = FontRepository.FindFont(“TimesNewRoman”);
n .TextState.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray);
textFragmentadd.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Red);
// Append the text fragment to the PDF page
textBuilderadd.AppendText(n );
-------------------------------------------------------------------------------------------------------------------
Pls replay asap.
Here is my code:
:
string[] label = s.a.Split(','); //contain text1,text2
TextBuilder textBuilderadd = new TextBuilder(pdfPage);
for (int i = 0; i < label.Length; i++)
{
TextFragment textFragmentadd = new TextFragment(label[i]);
textFragmentadd.Position = new Position(20, 600-i);
// Set text properties
textFragmentadd.TextState.FontSize = 12;
textFragmentadd.TextState.Font = FontRepository.FindFont("TimesNewRoman");
textFragmentadd.TextState.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray);
textFragmentadd.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Red);
// Append the text fragment to the PDF page
textBuilderadd.AppendText(textFragmentadd);
}