跳到主要内容

从表单中提取数据 PDFn8n

从表单中提取数据 PDF 是一个 PDF4me 节点操作 n8n 从可填写对象中读取已填写的值。 PDF 并以结构化的形式返回它们。 formData JSON 对象。用它来翻转已退回的申请表、已签名的登记表或调查问卷。 PDFs 无需任何人重新输入答案,即可将答案写入数据库行。

此节点的功能

PDF4me从表单中提取数据 PDF 需要填写完整的表格 PDF 来自二进制数据, Base64 String或者 URL读取其交互式表单层,并将每个字段作为名称和值对包含在单个对象中返回。 表单数据 对象。文本输入框、复选框、单选按钮和下拉列表选项全部汇集在一起,准备映射到电子表格行。 CRM 记录,或工作流中的条件分支。

相关博客文章(1)

验证您的身份 API 要求

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

您不容错过的重要事实

PDF 必须有实际的表单字段
此节点读取交互式 AcroForm 图层。扫描页面或展平的页面。 PDF 没有剩余的字段对象要读取,因此将这些对象路由到 OCR 或者 AI 改为解析节点。
输出结果中仍然会出现空白字段。
未填充的字段会返回空字符串而不是被省略,因此应在下游检查空值,而不是假设键缺失。
字段名称来自表单作者
钥匙匹配任何 PDF 设计者为每个字段命名,复选框返回其导出值,而不是保证返回真或假。请先运行一个示例文件并检查实际输出。
在 n8n 中,PDF4me 节点设置为“操作:从 PDF 中提取表单数据”,“输入数据类型:二进制数据”,“输入二进制字段:数据”,“文档名称:document.pdf”,并在“高级选项”下设置了“自定义配置文件”。

PDF4me 从表单中提取数据 PDF 参数面板 n8n

表单数据提取与纯文本提取

两种方法都从中提取内容 PDF但只有一种方法可以提供命名字段。这种区别决定了哪个节点应该属于你的工作流。

方法你得到的回报最佳匹配
Extract Form Data From PDFNamed field and value pairs from the interactive form layerGenuine fillable PDFs where every answer already sits in a named field
Plain text extractionThe visible page content as one flat string, with no field namesStatic PDFs with no form layer, where you will parse the text yourself
AI document parsingModel-inferred fields from any layout, including scansScanned, flattened, or wildly inconsistent documents with no usable form structure

从哪些参数中提取表单数据 PDF 需要?

必需的: 操作、输入数据类型、与该输入类型匹配的字段以及文档名称。“高级选项”下的“自定义配置文件”是可选的。

范围必需的它的作用例子
ActionRequiredSelects the PDF4me node action to run. Choose Extract Form Data From PDF.Extract Form Data From PDF
Input Data TypeRequiredFormat of the source PDF input. Choose Binary Data (from a previous node), Base64 String, or URL.Binary Data
Input Binary FieldConditionalName of the binary property on the incoming n8n item that holds the filled PDF. Required when Input Data Type is Binary Data. Defaults to data.data
Base64 Document ContentConditionalBase64-encoded content of the filled PDF. Required when Input Data Type is Base64 String.JVBERi0xLjQK...
File URLConditionalPublicly reachable HTTPS URL to the filled PDF. Required when Input Data Type is URL.https://example.com/application_form.pdf
Document NameRequiredFilename of the source PDF, used for reference and tracking in the extraction request. Include the .pdf extension.application_form.pdf
Custom ProfilesOptionalAdvanced Options field for extra processing settings, supplied in a JSON-like format. Leave blank unless you have a specific profile to apply.{ 'outputDataFormat': 'json' }

输出字段

一次成功的运行返回一个 n8n 包含提取表单值的项 JSON

场地类型它包含什么
formDataObjectEvery form field read from the PDF, as a set of field name and field value pairs.
formData.<fieldName>StringThe name of an individual field exactly as the PDF author defined it, for example name, email, or country.
formData.<fieldValue>String, Number, or BooleanThe value entered or selected for that field. Blank fields return an empty string, and checkboxes return their export value.

典型的回复正文如下所示:

{
"formData": {
"name": "PDF4me",
"email": "",
"country": "USA"
}
}

如何设置从表单提取数据 PDFn8n

  1. 添加 PDF4me 致你 n8n 工作流程并选择 从表单中提取数据 PDF 行动。
  2. 用于连接的凭证请选择您的 PDF4me 凭证或点击 创建新凭证 并粘贴你的 API 钥匙。
  3. 输入数据类型二进制数据 (默认), Base64 String, 或者 URL 并提供配套的填充物 PDF 场地。
  4. 文档名称 例如,指向源文件名。 application_form.pdf
  5. 离开 自定义配置文件 在下面 高级选项 除非您需要特定的处理配置文件,否则请留空。
  6. 执行该节点,然后映射返回值。 formData 将对象放入工作流程的下一步。

典型配置

工作流程示例Common n8n workflow patterns using Extract Form Data From PDF.
通过电子邮件将申请表导入电子表格
  1. 当申请完成时,会触发电子邮件通知。 PDF 到达。
  2. 从表单中提取数据 PDF 将附件读取到 formData 对象中。
  3. Google 表格或 Excel 节点追加一行,将每个字段名称映射到一列。
CRM 通过问卷调查表获取潜在客户
  1. 云存储触发器会在新上传的数据到达时触发。 PDF
  2. 从表单中提取数据 PDF 从表单层中提取联系信息。
  3. A CRM 节点使用提取的姓名、电子邮件和公司值创建或更新记录。
有条件批准流程
  1. webhook 会从外部门户接收已签名的请求表单。
  2. 从表单中提取数据 PDF 返回所请求的金额和部门字段。
  3. 根据这些值,IF 节点会分支到正确的审批人。
档案批量数字化
  1. “循环遍历项目”节点遍历已归档表单的列表 URLs
  2. 从表单中提取数据 PDF 运行时输入数据类型设置为 URL 对每个文件。
  3. 每个 formData 对象都会被写入一个以源文档名称为键的数据库表中。

实用技巧

Run one sample file before you map anything
Field names and checkbox export values are set by whoever designed the form, so inspect the real formData output first instead of guessing the key names.
Test for empty strings, not missing keys
Unfilled fields are still present in the output with an empty value, so a simple key existence check will not tell you whether the user answered.
Check the PDF is not flattened
A form that looks fillable in a viewer may have been flattened on save, which strips the field layer. If formData comes back empty, that is usually why.
Send scans to an AI parser instead
Scanned paper forms have no interactive fields at all. Route those to Parse Document rather than expecting this node to read them.
Keep Document Name meaningful
It is used for reference and tracking on the request, so passing the real source filename makes execution logs far easier to audit later.
Validate before writing to a system of record
Add a check on required fields after extraction so an incomplete submission is flagged rather than silently creating a half-empty CRM record.

速查表

场地价值
ActionExtract Form Data From PDF
Input Data TypeBinary Data
Input Binary Fielddata
Document Namedocument.pdf
Custom Profiles{ 'outputDataFormat': 'json' }
CredentialsPDF4me API credential
ReturnsformData object of field name and value pairs

常见问题

Does Extract Form Data From PDF work on a scanned or flattened PDF?+
No. This node reads values from real interactive form fields, the AcroForm layer described in the ISO 32000 PDF specification. A scanned page is just an image, and a flattened PDF has had its fields painted into static content, so in both cases there are no field objects left to read. For those files use an OCR or AI parsing node instead, such as Parse Document.
What do empty form fields return?+
A field the user left blank still appears in the formData object, with an empty string as its value. The key set reflects the fields defined in the PDF, not only the ones that were filled in, so downstream nodes should test for empty values rather than assume a missing key.
How are checkboxes and radio buttons returned?+
Checkbox and radio button fields return their underlying export value as defined in the PDF, not always a literal true or false. Common values include Yes, Off, or a named choice set by whoever built the form. Run the node once on a sample filled PDF and inspect the actual output before writing comparison logic against it.
Can I send extracted PDF form data straight to Excel or a database?+
Yes. The formData object is standard JSON, so any node that accepts item fields can consume it. Map formData keys onto columns in a spreadsheet, database, or CRM node placed after the PDF4me node, using the standard n8n data mapping approach.
What is the difference between extracting form data and extracting text from a PDF?+
Extracting form data reads named field values from the interactive form layer, so you get reliable key and value pairs such as email mapped to its entered address. Extracting text returns the visible page content as a flat string with no field names attached, leaving you to parse it. Prefer form data extraction whenever the PDF is a genuine fillable form.

相关操作

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

获取帮助