可通过 C++ 填写的 PDF 表单

通过 C++ 创建可填写的 PDF 表单。使用服务器端 API 构建自己的 C++ 应用程序

如何使用 C++ 库填写 PDF 表单

为了在 PDF 文件中填写 PDF 表单 (Acroforms),我们将使用 Aspose.PDF for C++ API,这是适用于 cpp 平台的功能丰富、强大且易于使用的文档操作 API。打开 NuGet 包管理器,搜索aspose.pdf然后安装。您也可以使用包管理器控制台中的以下命令。

如何使用 C++ 在 PDF 中填写 AcroForm


你需要 Aspose.PDF for C++ 才能在你的环境中试用代码。

1.在 “文档” 类的实例中加载 PDF。 1.在 PDF 文件中创建字段。 1.向文档中添加字段。 1.保存修改过的 PDF

在 PDF 中填写 AcroForm-C++

此示例代码显示如何使用 C++ 在 PDF 中填写 PDF 表单

    String _dataDir("C:\\Samples\\");

    // Open document
    auto document = MakeObject<Document>(_dataDir + u"FillFormField.pdf");

    // Get a field
    auto textBoxField = System::DynamicCast<Aspose::Pdf::Forms::TextBoxField>(document->get_Form()->idx_get(u"textbox1"));

    // Modify field value
    textBoxField->set_Value(u"Value to be filled in the field");

    // Save updated document
    document->Save(_dataDir + u"FillFormField_out.pdf");