VintaSoft PDF .NET Plug-in Discussions
Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.
Board index < VintaSoft Imaging < VintaSoft PDF .NET Plug-in Discussions
private void ConcatenateDocuments(string parentDocumentPath, List<string> childDocumentPaths)
{
PdfDocument parentDocument = new PdfDocument(parentDocumentPath);
foreach (string childDocumentPath in childDocumentPaths)
{
PdfDocument childDocument = new PdfDocument(childDocumentPath);
foreach (FormField field in childDocument.InteractiveForm.Fields)
{
// The problem happens here because the parentDocument.InteractiveForm does not get updated when we
// add the second document, so the check doesn't behave when the third document and on are added.
if (parentDocument.InteractiveForm.Fields.Contains(e => e.Name == field.Name))
{
// Rename the child fields before adding them. Note that what we're doing is a little more complicated
// than this because we need to make sure the renamed value doesn't exist in the parent as well, but
// this is close enough to explain what we're trying to do. If _?2 exists, we use _?3 and so on.
field.Name = field.Name + _?2;
}
}
parentDocument.AddDocument(childDocument);
}
}
Any guidance you can offer us would be greatly appreciated.