跳到主要内容

填写 PDFn8n

此节点的功能

PDF4me填写 PDF 形式 需要一个可填写的 PDFAcroForm) 并用您的数据填充其字段 n8n 步骤一:提供模板 Binary DataBase64, 或者 URL 以及字段值作为 JSON 目的JSON 字符串、二进制或 Base64)或作为 字段名称/字段值行返回已完成的 PDF可以是扁平化格式(默认)或保留可编辑字段格式。非常适合填写申请表、合同、收据表格或任何其他表格。 AcroForm 模板来自 CRM、webhook 或电子表格数据。

相关博客文章(1)

验证您的身份 API 要求

每一个 PDF4me 节点 n8n 需要有效 用于连接的凭证创建或选择一个可以容纳您的 PDF4me API 关键在于确保工作流程能够安全地验证表单填写请求。

您不容错过的重要事实

PDF 必须已经拥有 AcroForm 字段
此节点用于填充现有表单字段,而不是创建新字段。没有字段的平面扫描无法填充。请使用“添加表单字段”节点。 PDF 首先,如果你的模板只有视觉占位符。
钥匙必须匹配 AcroForm 字段名称完全一致
字段名称区分大小写,并且通常与可见标签不同( 而不是 运行“从表单提取数据” PDF 首先在模板上查看,或者使用 Adobe Acrobat Prepare Form 查看以获取准确的列表。
表单数据(JSON) 需要一个对象,而不是一个列表
发送单个 JSON 目的 ({"firstname":"John","lastname":"Doe"}包含单个对象的数组会被解包;包含多个对象的数组会被拒绝。要填充多个对象,需要进行以下操作。 PDF如果一次运行中出现 s,请将此节点包装在“循环遍历项目”中。
填写 PDF 表单,n8n 节点已配置凭据以连接到 Pdf4me,资源表单,表单操作,填写 PDF 表单,PDF 输入数据类型为二进制数据,PDF 二进制字段数据,选择输入类型输入表单数据,两个示例表单字段,字段名称“名字”值为“shakti”,字段名称“姓氏”值为“Karmakar”,以及一个“添加表单字段”按钮

完整节点面板: PDF 通过模板 Binary Data + 输入表单数据字段行

参数

必需 n8n UI 用于连接的凭证 PDF 输入数据类型、选择输入类型,以及(取决于选择输入类型)表单数据输入类型及其匹配的内容字段,或者至少一行包含字段名称和字段值的表单字段。输出文件名(默认值) 已填写的表单输出.pdf), 保持 PDF 可编辑(关闭)和 Binary Data 输出名称(默认值) 数据)是可选的。条件模板字段(PDF 二元字段, PDF Base64 内容, PDF URL)仅在选择其输入类型时才会出现。

范围必需的它的作用例子
PDF Input Data TypeYesHow the PDF template enters the node. Binary Data reads from a previous node (default, most common). Base64 String accepts an encoded PDF. URL downloads the PDF from a public link.Binary Data
PDF Binary FieldConditionalName of the binary property on the incoming n8n item that holds the PDF. Required when PDF Input Data Type is Binary Data. Defaults to data.data
PDF Base64 ContentConditionalBase64-encoded PDF content. Required when PDF Input Data Type is Base64 String. Data-URL prefixes (data:application/pdf;base64,) are stripped automatically.JVBERi0xLjQK...
PDF URLConditionalPublicly reachable HTTPS URL to the PDF template. Required when PDF Input Data Type is URL. Must be a valid full URL format.https://example.com/application-form.pdf
Select Input TypeYesHow the field values are supplied. JSON sends a stringified JSON object via dataArray. Input Form Data adds one UI row per field with Field Name and Field Value.JSON
Form Data Input TypeConditionalHow the JSON object is supplied. Required when Select Input Type is JSON. JSON String pastes the object directly (default). Binary Data reads a JSON file from a previous node. Base64 String accepts an encoded JSON object.JSON String
Form Data (JSON)ConditionalRaw JSON object whose keys are PDF field names and values are what to fill. Required when Form Data Input Type is JSON String. Must be a single object, not a list.{"firstname":"John","lastname":"Doe","email":"[email protected]"}
Form Data Binary FieldConditionalName of the binary property on the incoming n8n item that holds the JSON data file. Required when Form Data Input Type is Binary Data. Defaults to data.data
Form Data Base64 ContentConditionalBase64-encoded UTF-8 JSON object. Required when Form Data Input Type is Base64 String. Decoded then stringified into dataArray.eyJmaXJzdG5hbWUiOiJKb2huIn0=
Form FieldsConditionalCollection of field rows. Required when Select Input Type is Input Form Data. Add at least one row via Add Form Field. The node errors if the list is empty.[{Field Name: firstname, Field Value: John}]
Field Name (per row)ConditionalExact AcroForm field name to fill. Required for every row added to Form Fields.firstname
Field Value (per row)ConditionalValue to fill into the matching AcroForm field. Required for every row added to Form Fields.John
Output File NameNoFilename of the filled PDF returned by the node. Default is filled_form_output.pdf. Include the .pdf extension.filled_form_output.pdf
Keep PDF EditableNoToggle to keep AcroForm fields editable on the filled PDF. Off (default) flattens the form into static text. On preserves field definitions so the recipient can re-edit.Off
Binary Data Output NameNoName of the binary property the output item exposes. Default is data. Use a different name when a downstream node expects it.data

PDF 输入数据类型选项

选择如何 PDF 模板进入节点。后续字段会根据此选择而改变。

n8n PDF4me 的“填写 PDF 表单”节点中的“PDF 输入数据类型”下拉菜单显示三个选项:二进制数据(高亮显示并附说明)、使用上一个节点中的 PDF 文件、Base64 字符串(附说明)、提供 PDF 文件的 URL(附说明)。

PDF 输入数据类型: Binary DataBase64 字符串,或 URL

二进制数据默认: PDF 来自前一个节点
阅读 PDF 直接从先前的节点(例如 Google 云端硬盘下载)下载, HTTP 请求或读取二进制文件。设置 PDF二进制字段 二进制字段名称(默认值) 数据)。
Base64字符串PDF 作为 base64 字符串
将 base64 字符串粘贴或映射到 PDF Base64 内容。 数据-URL 样式前缀(data:application/pdf;base64,)会被自动剥离。
URL从公共链接下载
提供完整的 HTTPS URLPDF URLPDF4me 直接获取模板。 URL 必须有效且无需身份验证即可访问。

选择输入类型选项

选择字段值的提供方式。后续字段会根据此选择而变化。

在 n8n PDF4me 的“填写 PDF 表单”节点中,“选择输入类型”下拉菜单显示两个选项:JSON(描述:将表单数据作为字符串化的 JSON 对象发送到 dataArray)和“输入表单数据”(描述:将表单数据作为字段名值对数组发送)。

选择输入类型: JSON (对于数据数组)或输入表单数据(UI 行)

JSON最适合多字段和动态数据
发送一个字符串 JSON 通过对象 API 数据数组 字段。键是 PDF 字段名称和值是需要填写的内容。添加后续表单数据输入类型选项(JSON 细绳, Binary Data, 或者 Base64 字符串)来提供对象。
输入表单数据最适合配置中的小型固定集。 UI
通过以下方式为每个字段添加一行 添加表单字段每一行都有一个 字段名称 (精确的 AcroForm 姓名)和 字段值如果列表为空,则该节点会报错。

表单数据输入类型选项(当选择输入类型时) JSON

在 n8n PDF4me 的“填写 PDF 表单”节点中,“表单数据输入类型”下拉菜单会在“选择输入类型”为 JSON 时显示三个选项:JSON 字符串(高亮显示并附有说明):以文本或对象形式提供 JSON 内容;二进制数据(附有说明):使用来自上一个节点的 JSON 文件;Base64 字符串(附有说明):以 Base64 编码字符串形式提供 JSON 内容。

表单数据输入类型: JSON 细绳, Binary Data, 或者 Base64 细绳

JSON 字符串默认值:粘贴或映射 JSON 排队
直接将对象键入 表单数据(JSON) 或者从之前的节点表达式映射它。最常见的选择是 CRM-驱动或webhook驱动的工作流。
二进制数据JSON 来自先前节点的文件
表单数据二进制字段 二进制字段名称(默认值) 数据)。当……时使用 JSON 以下载文件的形式到达。该文件必须包含单个对象。
Base64字符串Base64编码 JSON 目的
提供 UTF-8 JSON 将对象作为 base64 编码 表单数据 Base64 内容该节点将其解码并字符串化。 数据数组

表单数据(JSON)示例

什么时候 Form Data Input TypeJSON 字符串,粘贴一个键值完全匹配的单个对象。 AcroForm 字段名称。

表单数据输入类型设置为 JSON 字符串,表单数据 (JSON) 编辑器显示单个内联 JSON 对象,内容为 firstname John lastname Doe email john at example dot com,后跟输出文件名 filled_form_output.pdf

JSON 字符串输入:一个对象,键匹配 AcroForm 字段名称完全一致

{
"firstname": "John",
"lastname": "Doe",
"email": "[email protected]"
}

输出字段

一次成功的运行返回一个 n8n 携带物品 JSON 元数据和已填写的内容 PDF

场地类型它包含什么
successBooleanTrue when the PDF was filled successfully. Use to route error-handling branches.
messageStringHuman-readable status confirming success or describing an error.
fileNameStringFilename of the filled PDF, set from Output File Name (default filled_form_output.pdf).
mimeTypeStringMIME type of the filled file, application/pdf.
fileSizeNumberSize of the filled PDF in bytes.
inputModeStringWhich input mode was used: json or inputFormData.
fieldCountNumberHow many form fields were sent in this request.
Binary (data)BinaryThe filled PDF under Binary Data Output Name (default data). Pass into Write Binary File, Email, or any cloud-storage upload.

快速设置

  1. 添加 PDF4me 致你 n8n 工作流程。设置 资源表格表单操作填写 PDF 形式
  2. 用于连接的凭证请选择您的 PDF4me 凭证或点击 创建新凭证 并粘贴你的 API 钥匙。
  3. PDF 输入数据类型Binary Data (默认), Base64 细绳, 或者 URL 并填写匹配字段(PDF二进制字段PDF Base64 内容, 或者 PDF URL)。
  4. 选择输入类型JSON (然后选择) 表单数据输入类型 = JSON 细绳 / Binary Data / Base64 字符串并提供对象)或 输入表单数据 (点击 添加表单字段 每个字段添加一行 字段名称字段值)。
  5. 确保每 字段名称 匹配 AcroForm 模板中的字段名称必须完全一致(区分大小写)。使用“从表单提取数据”功能。 PDF 如果您不确定,请先咨询。
  6. (可选)更改 输出文件名 从默认值 filled_form_output.pdf
  7. 切换 保持 PDF 可编辑 仅当收件人需要能够重新编辑已填写的字段时才启用。默认情况下禁用此功能会将表单展平。
  8. 离开 Binary Data 输出名称 作为 data 除非下游节点需要不同的属性名称。执行该节点并路由已填充的数据。 PDF 写入二进制文件、电子邮件或云存储。

典型配置

工作流程示例Common n8n workflow patterns using Fill a PDF Form.
文件。填写。保存: PDF 来自 Drive 的模板,内联值
  1. Google 云端硬盘下载节点会拉取申请表。 PDF 模板 (Binary Data, 财产 数据)。
  2. PDF4me 填写 PDF 形式运行与 PDF 输入数据类型 Binary Data选择输入类型 JSON表单数据输入类型 JSON 细绳。 表单数据(JSON) 是一个单独的内联对象。
  3. “写入二进制文件”节点保存已填充的文件。 PDF 使用 $json.fileName
将先前节点的值映射到表达式
  1. webhook 从网站接收表单提交的有效负载。
  2. PDF4me 填写 PDF 表单配置了选择输入类型 JSON表单数据输入类型 JSON 细绳。 表单数据(JSON) 是一个 n8n 将 webhook 有效负载直接映射到 AcroForm 场形状({{ { firstname: $json.first, lastname: $json.last } })。
  3. Gmail 节点会将填好的邮件发送给用户。 PDF 以附件形式返回给提交者。
很少的领域,没有 JSON:输入表单数据行
  1. 一份入院表格只有三个部分 AcroForm 字段: 电子邮件
  2. PDF4me 填写 PDF 表单已设置为“选择输入类型”和“输入表单数据”。通过以下方式添加了三行数据: 添加表单字段 使用确切的字段名称和键入或表达式映射的值。
  3. 保持 PDF 已关闭编辑功能,因此填写后的表单将被扁平化。
  4. PDF 已上传至 SharePoint 文档库。
PDFJSON 作为单独的文件,合并在一起 n8n
  1. 一个节点下载 PDF 模板;另一个节点下载该模板 JSON 数据文件。合并节点将它们合并成一个项目。
  2. PDF4me 填写 PDF 表单已配置 PDF 输入数据类型 Binary DataPDF二进制字段 设置为 PDF 字段名称)和选择输入类型 JSON表单数据输入类型 Binary Data表单数据二进制字段 设置为 JSON 字段名称)。
  3. 已填满 PDF 订单已保存 ID 作为文件名。
可编辑填充 PDF 供收件人填写
  1. A CRM 更新操作会在创建新客户时触发工作流。
  2. PDF4me 填写 PDF 表单预先填写了客户已知的注册表单字段(姓名电子邮件账户 ID使用选择输入类型 JSON
  3. 保持 PDF 可编辑 已启用,以便客户可以填写剩余的可选字段。
  4. 一个 Outlook 节点通过电子邮件发送预先填写的可编辑内容。 PDF 并附有截止日期提醒。

实用技巧

Wrong field names are the #1 cause of empty output
Run Extract Form Data From PDF on the template first to get the exact list. Names are case-sensitive and usually have no spaces (firstname, not First Name).
"No binary data found" errors
Double-check PDF Binary Field and Form Data Binary Field names. The Merge node in a fan-in workflow can rename binary properties.
Prefer JSON for many or dynamic fields
Input Form Data is great for 2-3 hardcoded fields, but JSON scales better and works naturally with expressions from previous nodes.
Keep PDF Editable only when needed
Default off flattens the form, which is the right choice when the filled PDF is a final record. Turn on only when the recipient needs to add or change values.
Form Data (JSON) is one object only
Send a single object, not an array of records. An array of one is unwrapped; multiple objects fail. To fill many PDFs in one run, wrap this node in Loop Over Items.
No AcroForm fields means nothing to fill
A flat scan with no fields cannot be filled. Use Add Form Fields To PDF first to add fillable fields before calling Fill a PDF Form.

速查表

场地价值
ResourceForms
OperationFill a PDF Form
PDF Input Data TypeBinary Data
PDF Binary Fielddata
Select Input TypeJSON
Form Data Input TypeJSON String
Form Data (JSON){"firstname":"John","lastname":"Doe","email":"[email protected]"}
Output File Namefilled_form_output.pdf
Keep PDF EditableOff
Binary Data Output Namedata
CredentialsPDF4me API credential

常见问题解答

What is the difference between JSON and Input Form Data?+
JSON sends one stringified object via the API dataArray field. Keys are PDF field names and values are what to fill. Best for many fields, dynamic data mapped from previous nodes, or workflows that already produce JSON. Input Form Data adds one UI row per field with Field Name and Field Value. Best for a small fixed set of fields configured manually in the n8n editor.
How do I know the exact AcroForm field names?+
Run PDF4me Extract Form Data From PDF on the template first. The output is the exact list of field names you can use as keys in Form Data (JSON) or as Field Name rows in Input Form Data. Or inspect the PDF in Adobe Acrobat (Prepare Form) and read the field names from the properties panel. Field names are case-sensitive.
What does Keep PDF Editable do?+
Off (default) flattens the form into static text in the output PDF. Useful when the filled PDF is a final, locked record of what was submitted. On preserves AcroForm field definitions in the output so the recipient can re-edit values in any PDF viewer. Turn it on only when the recipient needs to add or change values after automation.
Can I send an array of multiple objects in Form Data (JSON)?+
No. The node expects a single object. An array containing one object is unwrapped automatically as a convenience. Arrays of multiple objects are rejected. To fill many PDFs in one execution, wrap this node in a Loop Over Items and call it once per object.
Why are some fields blank in the output PDF?+
Almost always because the keys you sent did not match the AcroForm field names exactly. Field names are case-sensitive and often have no spaces or capital letters (firstname instead of First Name). Confirm the exact names with Extract Form Data From PDF before mapping your data.
What happens with a flat PDF that has no form fields?+
Nothing fills. This node populates existing AcroForm fields; it does not create them. For a flat scan or a PDF with visual placeholders only, run Add Form Fields To PDF first to add fillable fields, then call Fill a PDF Form.
How do I send the PDF as base64 with a data: prefix?+
The node strips data-URL prefixes (data:application/pdf;base64,) automatically when you paste them into PDF Base64 Content, so it works either way.
Can I get a non-PDF output (e.g. PNG of the filled form)?+
No. This endpoint outputs PDF only. To rasterize the filled PDF into PNG or JPEG, chain a downstream PDF4me Convert PDF to Image action after Fill a PDF Form.

相关操作

在其他平台上执行相同任务

获取帮助