Pdf's fields should remain editable using itextsharp in asp.net

和自甴很熟 提交于 2019-12-02 07:10:02

Your code line

stamper.FormFlattening = true;

instructs iTextSharp to flatten the form fields, i.e. to integrate them into the page content and remove the form field annotations.

As you want to keep the form fields as editable fields, don't flatten the form.

Error: Cannot convert type in PDFHelper.cs

public static Dictionary<string, string> GetFormFieldNames(string pdfPath)
    {
        var fields = new Dictionary<string, string>();

        var reader = new PdfReader(pdfPath);
        foreach (DictionaryEntry entry in reader.AcroFields.Fields) //ERROR: 'System.Collections.Generic.KeyValuePair' to 'System.Collections.DictionaryEntry'
        {
            fields.Add(entry.Key.ToString(), string.Empty);
        }
        reader.Close();

        return fields;
    }

'System.Collections.Generic.KeyValuePair' to 'System.Collections.DictionaryEntry'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!