|
|
seems you should save, close and reopen destination document.
|
|
|
I am needing to add pages to an existing PDF from separate documents that all have form fields on them. The existing PDF also has its own forms fields on it. From the test I have ran it seems the fields are added (the fields are there after saving the doc) but just not seen by the FormFill.InterForm.Fields while the program is running. Code:
// ms is a memory stream
PdfForms forms = new PdfForms();
PdfDocument doc = PdfDocument.Load(ms, forms);
foreach(int pageIndex in listOfPageIndexes)
{
PdfForms formsDup = new PdfForms();
PdfDocument docDup;
// ms2 is a memory stream
docDup = PdfDocument.Load(ms2, formsDup);
//This renames the fields so that it can be added with conflicting with the previous document.
foreach (var field in docDup.FormFill.InterForm.Fields.ToList())
{
string fieldName = field.Dictionary.FirstOrDefault(u => u.Key.StartsWith("T")).Value.As<PdfTypeString>().AnsiString;
var typeString = field.Dictionary.FirstOrDefault(u => u.Key.StartsWith("T")).Value.As<PdfTypeString>();
typeString.AnsiString = fieldName + "_" + (index + 1).ToString();
}
doc.Pages.ImportPages(docDup, indexToPrint.ToString(), doc.Pages.Count);
}
|
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close