Anthony Willekens

Anthony Willekens

  • 2.1k
  • 19
  • 408

Duplicate editable field with PdfSharp on document creation

Jun 16 2020 3:23 AM

I create a pdf from a pdf template (cover, front page, back page). so I add x front page and x back page to the document created.

  1. PdfPage newPage = finalPdfDocument.AddPage(pageModelPdf.PdfPage);  

The problem is that these pages contain an editable field. Once the document is generated, if i enter text in this field on a front page, it is duplicated on each front page. I imagine that it is linked to the reference of the field which remains the same when I duplicate the pages. I try to rename the fields each time I add a page but by doing that the field is no longer editable.

  1. field.Elements.SetName("/T",  $"{fieldName}_{finalPdfDocument.PageCount}");

Any idea?


Answers (1)