We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Time to add 4 text fields to existing PDF

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?

Hi Kenneth,


Thanks for your inquiry. We will appreciate it if you please share your sample PDF document, we will test the scenario at our end and will provide you information accordingly.

We are sorry for the inconveneince caused.

Best Regards,