Patagames Software Support Forum
»
Pdfium.Net SDK
»
Common Questions
»
How do I import not only a page but its form fields / controls.
Rank: Member
Groups: Registered
Joined: 2/21/2019(UTC) Posts: 15
|
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);
}
Edited by user Monday, March 4, 2019 6:31:42 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
seems you should save, close and reopen destination document.
|
|
|
|
|
|
Patagames Software Support Forum
»
Pdfium.Net SDK
»
Common Questions
»
How do I import not only a page but its form fields / controls.
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.
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