0

我正在以编程方式填充使用 Livecycle 创建的 PDF(加上通过 Adob​​e Acrobat 的扩展功能)。填充字段后,我希望允许用户编辑和保存。

private void XMLFieldPopulate(PdfReader reader, Dictionary<string, string> listOfValues, PdfStamper stamper)
    {
        AcroFields form = reader.AcroFields;
        XfaForm xfaform = form.Xfa;
        XmlNode node = xfaform.DatasetsNode;
        XmlNodeList list = node.ChildNodes;

        do
        {
            node = list.Item(0);
            list = node.ChildNodes;
        } while (node.Name != "topmostSubform");

        for (int i = 0; i < list.Count; i++)
        {

            string attribute = list[i].Name;
            string value = string.Empty;

            value = listOfValues.First(x => x.Key == attribute).Value;
                list[i].InnerText = value;
        }

        xfaform.FillXfaForm(node);
        xfaform.SetXfa(stamper.Writer);

我可以让 PDF 填充并对其进行编辑,但它不允许保存。

4

0 回答 0