Hi ,
I am using Aspose PDF(full license) to merge multiple pdfs into a new PDF Document, and each page needs two text data, and a 2d data matrix bar code image to be added.
The files can be quite large (more than 5000 pages) and the number of pages vary.
Code snippet below
PdfFileStamp fileStamp = new PdfFileStamp(outputDocument);
foreach(Page page in fileStamp.Document.Pages)
{
// Create stamp
Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();
stamp.BindImage(ms);
stamp.SetOrigin(525, 15);
stamp.SetImageSize(20.0f, 20.0f);
stamp.Pages = new int[] { pageCount };
fileStamp.AddStamp(stamp);
//PdfFileMend mender = new PdfFileMend(fileStamp.Document);
//mender.AddText("", 1, pageCount, 200, 200, 400);
TextStamp textStamp = new TextStamp(string.Format("{0}-{1}/{2}", groupNo.ToString().PadLeft(6, '0'),
sheetCount.ToString().PadLeft(2, '0'), totalSheets.ToString().PadLeft(2, '0')));
textStamp.XIndent = 430;
textStamp.YIndent = 15;
textStamp.TextState.Font.IsSubset = true;
fileStamp.Document.Pages[pageCount].AddStamp(textStamp);
TextStamp idTextStamp = new TextStamp(string.Format("{0}/{1}/{2}", pdf.ClientName.ToUpper(), pdf.BatchName, pdf.DocumentID));
idTextStamp.XIndent = 15;
idTextStamp.YIndent = 15;
idTextStamp.TextState.Font.IsSubset = true;
fileStamp.Document.Pages[pageCount].AddStamp(idTextStamp);
}
Is there a faster and more efficient way of doing this ? At the moment it takes about 6 minutes to execute this program, while it takes only less than 2 minutes to complete the program with these rows of code commented out.
Thanks