I was adding text to a Federal 941 it took 1.85 secs to add 4 lines. That is unacceptable when I need to add upwards of 150 fields total
static void Main(string[] args)
{
Document doc = new Document(“C:\49411.pdf”);
Page pdfPage = (Page)doc.Pages[1];
TextBuilder tb = new TextBuilder(pdfPage);
saveText(“770114583”, 188, 72, tb);
saveText(“Sample Company”, 144, 96, tb);
saveText(" 12.33", 446, 252, tb);
saveText(" 1234.22", 446, 276, tb);
doc.Save(“c:\temp\941.pdf”);
}
my saveText method:
static void saveText(string sData, int x, int y, TextBuilder tb)
{
TextFragment textFragement = new TextFragment(sData);
textFragement.Position = new Position(x, getY(y));
textFragement.TextState.FontSize = nFontSize;
textFragement.TextState.Font = FontRepository.FindFont(sFont);
textFragement.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Black);
//textFragement.TextState.HorizontalAlignment = HorizontalAlignment.Right;
tb.AppendText(textFragement);
}
Why is it taking so long?