Код: Выделить всё
PdfDocument templateReader = PdfReader.Open(templateStream, PdfDocumentOpenMode.Modify);
IDictionary fieldVals = mergeItem.MergeFieldValues;
PdfAcroForm form = templateReader.AcroForm;
form.Elements.SetName("/NeedAppearances", "true");
form.Elements.SetBoolean("/NeedAppearances", true);
if (form != null && form.Fields.Count > 0)
{
foreach (string fieldName in form.Fields.DescendantNames)
{
PdfAcroField field = form.Fields[fieldName];
if (field is PdfTextField textField && fieldVals.ContainsKey(textField.Name))
{
textField.Value = new PdfString(fieldVals[textField.Name]);
textField.ReadOnly = true;
textField.Text = fieldVals[textField.Name];
textField.MultiLine = true;
textField.Font = new PdfSharp.Drawing.XFont("Arial", 30, XFontStyleEx.Regular);
}
}
form.Elements.SetBoolean("/NeedAppearances", true);
}
Как мне получить доступ к другим полям.
Подробнее здесь: https://stackoverflow.com/questions/790 ... arp-in-net
Мобильная версия