Merge PDF Fragments into Table Cells

I have a bunch of PDF fragment files (not full pages) that I need to insert into a table that I have in a Document.Page.


How can I do this?

I tried this, but it appends a new page and I can’t control the spacing between fragments or add a header or anything.
List docs = new List();
foreach (var file in filenames)
{
	var path = Path.Combine(AssetsPath, "infoCards", file);
	if (File.Exists(path)){
		docs.Add(new Document(path));
	}
}
PdfFileEditor editor = new PdfFileEditor();
editor.Concatenate(docs.ToArray(), Doc);

I answered my own question. Use a stamp. And then figure out the position based on 0,0 being the bottom left of the page… Here’s some of my code

for (int i = 0; i < filenames.Count(); i++)
{
	var path = Path.Combine(AssetsPath, "infoCards", filenames[i]);
	if (File.Exists(path))
	{
                Document fragmentDoc = new Document(path);
		Page fragmentPage = fragmentDoc.Pages[1];

		//centered horizontally
		xPos = (page.ArtBox.Width - fragmentPage.ArtBox.Width) / 2;

		//position from bottom
		yPos = yPos - fragmentPadding - fragmentPage.ArtBox.Height;

		var stamp = new PdfPageStamp(fragmentPage);
		stamp.Background = false;
		stamp.XIndent = xPos;
		stamp.YIndent = yPos;

		page.AddStamp(stamp);

....

Hi Dirk,


Thanks for using our API’s.

Yes you are correct. In order to stamp pages of existing PDF document, you need to use PdfPageStamp instance. Please continue using our API and in the event of any further query, please feel free to contact.