跳到主要内容

AI - 文档解析器 n8n

此节点的功能

PDF4me AI文档解析器 通过运行已保存的脚本,从任何文档中提取结构化数据。 AI 分析器 你的 PDF4me 根据文件创建账户。与固定解析器(AI发票解析器、AI流程合同)不同,您可以选择…… AI 分析器 ID 从配置的分析器下拉菜单中 PDF4me 仪表盘,因此同一个节点可以处理发票、采购订单、收据、自定义表单、实验室报告、内部模板以及您在模式中描述的所有内容。使用 解析 单个模式或 分类 一次调用即可分析多个文档变体。返回动态结果。 JSON 由您的模式加上一个键 元数据 块,无二进制文件。

相关博客文章
目前尚无关于此功能的博客文章——敬请期待。
在此期间,您可以浏览 PDF4me 博客,查看适用于各平台的教程和工作流程。
访问博客

测试发票样本

在将工作流指向真实数据之前,请使用此示例供应商发票确认节点端到端运行正常。将其映射为二进制输入并选择 default_invoice_extraction 作为 AI 分析器 ID

验证您的身份 API 要求

每一个 PDF4me 节点 n8n 需要有效 用于连接的凭证创建或选择一个可以容纳您的 PDF4me API 关键在于工作流程能够进行身份验证 AI 安全地执行提取请求。同一凭证也用于…… AI 分析器 ID 通过 GetAnalyzerId 下拉菜单 API

首先设置分析器

本指南中将使用的仪表盘网址:
首先创建您的分析器(所有平台均需此步骤)
AI - 文档解析器会在 PDF4me 开发者仪表盘中运行一个已保存的分析器。 选择“解析”可处理单一文档模式,或选择“分类”可在单次调用中对多种变体(如客户ABC、客户XYZ、通用发票)进行路由。同一分析器ID可在Make、Zapier、Power Automate、n8n以及REST API中使用。

您不容错过的重要事实

您在控制面板中设置了分析器,节点只是引用它。
只需在文档中定义一次架构、字段和提示即可。 分析器列表分析器详情 页面(解析一个模式,分类多个变体)。 n8n 节点会将你的分析器加载到…… AI 分析器 ID 从下拉菜单中选择一项即可运行。之后编辑架构无需修改工作流程。
输出是动态的 JSON没有二进制文件
顶级键与您在分析器中定义的字段名称(字符串、数字、日期或表行)相匹配。 元数据 对象始终会附加 success、message、timestamp、source filename、analyzer Id 和 operation 等信息。没有 输出二进制字段名称
解析还是分类由分析器决定,而不是由节点决定。
同一节点,两种分析器模式。 解析 分析器返回其单一模式中的字段。 分类 分析器将文档路由到最匹配的模式,并返回其分类名称。 匹配的模式提取字段。通过切换 ID 来切换行为。
AI 文档解析器 n8n 节点显示凭证 Pdf4me、资源提取、提取操作 AI 文档解析器、输入数据类型二进制数据、输入二进制字段数据、文档名称 document.pdf 和 AI 分析器 ID 下拉列表未设置(突出显示为必需)

完整节点面板:提取 → AI 支持二进制数据输入的文档解析器。选择一个 AI 分析器 ID 跑步之前。

参数

本指南中将使用的仪表盘网址:

必需 n8n 用户界面: 连接凭证、输入数据类型、文档名称 AI 分析器 ID。条件必填字段(输入二进制字段、Base64 文档内容或文档 URL)仅在选择匹配的输入数据类型时才会显示。 输出二进制字段名称 并且没有 高级选项/自定义配置文件 本次行动。

范围必需的它的作用例子
Input Data TypeYesHow the document is supplied. Binary Data reads from a previous node (default, most common). Base64 String accepts an encoded document. URL downloads the document from a public link.Binary Data
Input Binary FieldConditionalName of the binary property on the incoming n8n item that holds the document. Required when Input Data Type is Binary Data. Defaults to data. Error reports which property was missing when the name is wrong.data
Base64 Document ContentConditionalBase64-encoded document. Required when Input Data Type is Base64 String. Data-URL style prefixes (text before the comma) are stripped automatically.JVBERi0xLjQK...
Document URLConditionalPublicly reachable HTTPS URL to the document. Required when Input Data Type is URL. Must be a valid full URL.https://example.com/document.pdf
Document NameYesFilename used by PDF4me for processing. Default document.pdf. With Binary Data, the uploaded file name is used for upload but your explicit Document Name value takes precedence in the API call when set. Use a real extension (.pdf, .png, .jpg, etc.) so PDF4me handles the file correctly.document.pdf
AI Analyzer IdYesThe saved Analyzer that controls extraction. Create Analyzers at https://dev.pdf4me.com/dashboard/#/ai-document-parser/ (+ Add), then edit schemas on https://dev.pdf4me.com/ai-document-parser/?id=<analyzer-guid>. Dropdown populated via GetAnalyzerId API. Sent as customisationNote. Pick Parse for one schema or Classify for many variants.aaaa133

输入数据类型选项

选择文档进入节点的方式。后续字段会根据此选择而改变。

n8n PDF4me AI 文档解析器节点中的“输入数据类型”下拉菜单显示三个选项:二进制数据(高亮显示并附说明):使用上一个节点中的文档文件;Base64 字符串(高亮显示并附说明):以 Base64 编码字符串的形式提供文档内容;URL(高亮显示并附说明):提供文档文件的 URL。

输入数据类型。二进制数据(默认)、Base64 字符串或 URL

二进制数据默认值:来自上一个节点的文件
直接从先前的节点(例如 Google 云端硬盘下载)读取文档, HTTP 请求、读取二进制文件或电子邮件附件节点。设置 输入二进制字段 二进制字段名称(默认值) 数据除非您指定文档名称,否则将使用上传的文件名。
Base64字符串内联编码文档
将 base64 字符串粘贴或映射到 Base64 文档内容数据 URL 样式前缀(逗号前的文本)会自动去除。 文档名称 正确的文件扩展名可以检测文件格式。
URL从公共链接下载
提供公共服务 HTTPS URL文档 URLPDF4me 直接获取文档。待处理的文件名取自…… URL 如果可能,请提供路径;否则,请从文档名称获取路径。

AI 分析器 ID 下拉菜单

下拉菜单的内容来自您的 PDF4me 通过账户 获取分析器 ID API 打开字段时,每个选项都是您保存的分析器。 PDF4me 仪表板。选择架构与您正在处理的文档类型相匹配的仪表板。

在 n8n PDF4me AI 文档解析器节点中打开 AI 分析器 ID 下拉菜单,显示三个示例分析器选项:aaaa133、TestTenantProject 和 TestTenant

AI 分析器 ID 下拉菜单已从您的设备加载 PDF4me 帐户。

解析分析器
单一文档模式。该节点返回该模式中定义的字段。最适合处理的每个文档都使用同一布局系列的情况。请参阅 解析设置指南 包括模式规则 字段类型:"表格" 对于嵌套行和 字段方法 (提取默认值,生成以导出/规范化)。
分类分析器
多个模式,每个文档变体对应一个模式。 AI 使用每个模式的分类提示,将传入文档路由到最匹配的模式,然后返回匹配的分类名称及其字段。请参阅 分类设置指南

下拉菜单为空? 节点显示 "GetAnalyzerId 没有返回任何分析器选项" 当您的帐户没有分析器或凭据无法访问时 API打开 分析器列表 并且至少添加一个分析器 分析器详情 页面,然后验证 API 输入您的 n8n 凭证。

输出字段

一次成功的运行返回一个 n8n 物品 JSON 仅此而已,没有二进制文件。顶级键与您的分析器架构匹配; _metadata 对象始终附加到末尾。

场地类型它包含什么
Top-level extracted fieldsDynamicOne key per field defined in your Analyzer schema (string, number, date, or nested table rows). Names match fieldName exactly.
_metadata.successBooleantrue on a successful parse.
_metadata.messageString"Document parsed successfully using AI Document Parser".
_metadata.processingTimestampStringISO timestamp of the parse.
_metadata.sourceFileNameStringDocument name used for processing.
_metadata.aiAnalyzerIdStringThe Analyzer Id you selected (sent as customisationNote to the API).
_metadata.operationString"aiDocumentParser".
rawContent (fallback only)StringIf the API returns plain text instead of JSON and parsing fails, the node wraps the response as { "rawContent": "<api response string>" } at the top level.

快速设置

  1. 首先构建分析器。打开 分析器列表, 点击 + 添加输入一个清晰的分析器 ID,选择 解析 或者 分类保存该行,然后在该行上添加文档架构。 分析器详情 请参阅页面。 解析设置指南 或者 分类设置指南 完整的模式规则,包括 fieldType: "table" 对于嵌套行和 fieldMethod (提取或生成)。
  2. 在你的 n8n 工作流程,点击 + 并搜索 PDF4me。 放 资源提炼提取操作AI文档解析器
  3. 用于连接的凭证请选择您的 PDF4me 凭证或粘贴 API 钥匙。
  4. 输入数据类型二进制数据(默认)从前一个节点读取,是最常见的。
  5. 填写匹配的输入字段(输入二进制字段Base64 文档内容, 或者 文档 URL)。
  6. 文档名称覆盖默认值 document.pdf 使用带有正确扩展名的真实文件名。
  7. 选择一个 AI 分析器 ID 从下拉菜单中选择(从您的帐户加载)。
  8. 执行该节点。输出项包含顶层已解析字段以及…… _metadata路由到 Set、代码、Google Sheets、Airtable、数据库、电子邮件或任何下游节点。

典型配置

工作流程示例Common n8n workflow patterns using AI Document Parser.
电子邮件附件导入 Google 表格
  1. 电子邮件触发器 (IMAP) 在收到新邮件时触发 PDF 依恋。
  2. AI 文档解析器以二进制数据作为输入数据类型运行,文档名称设置为附件文件名。 AI 分析器 ID 设置为您的 发票解析器 分析器。
  3. Google 表格 附加 将发票号、供应商名称、总金额、到期日写入应付账款跟踪表。
带分类功能的多供应商收件箱
  1. 受监视文件夹收到混合 PDFs 来自客户 ABC、客户 XYZ 以及长尾客户。
  2. AI 文档解析器设置为分类分析器 ID(每个供应商一个架构)。
  3. Switch 节点根据响应中返回的匹配分类名称进行分支,并将每个结果发送到匹配的下游表。
托管文档 URL
  1. Webhook 会收到来自您门户网站的文档链接。
  2. AI 文档解析器使用输入数据类型运行 URL 以及您的自定义表单分析器 ID。
  3. 输出 JSON 映射到 Dataverse / Airtable / Postgres 写入以创建新记录。
扫描、自动裁剪,然后解析
  1. 扫描仪输出的文件会落入一个边框较宽的文件夹中。
  2. AI自动裁剪文档 (资源) AI) 修剪边缘。
  3. AI 文档解析器在具有匹配的分析器 ID 的裁剪二进制文件上运行。
  4. 已解析 JSON 水流照常向下游流动。
先验证,再丰富
  1. AI 文档解析器返回结构化字段。
  2. 代码节点验证必填字段并应用业务规则。
  3. 如果有效,则 HTTP 请求会从您的 CRM 中提取供应商数据;如果没有,则会向 Slack 发送警报以供人工审核。

实用技巧

Set up the Analyzer in PDF4me first
The node does not define extraction rules. It runs whatever your selected Analyzer specifies. Build it in the dashboard before configuring the node.
Use Document Name with the real extension
PDF4me uses the extension for format detection. Even on Binary Data, an explicit Document Name with the correct extension is safest.
No Output Binary Field Name and no Advanced Options
Unlike AI Auto Crop Document, this operation has neither. The output is JSON only; there is nothing to write back as a binary file.
Plain-text fallback wraps as rawContent
If the API returns plain text instead of JSON and parsing fails, the node wraps the response as { "rawContent": "<string>" } so the workflow does not break.
Combine with AI Auto Crop Document for scans
Scans with wide borders parse better after cropping. Chain AI Auto Crop Document (Resource AI) before this node.
Use AI-Invoice Parser / AI-Process Contract for built-in schemas
When you only need standard invoice or contract fields, the dedicated nodes are simpler. AI Document Parser shines when you have a custom schema.

故障排除

AI 需要提供分析器 ID

运行前请从下拉菜单中选择分析器。该字段不能为空。

“属性‘…’中未找到二进制数据”

对齐 输入二进制字段 与前一个节点(通常) 数据错误信息会报告缺少哪个属性。

需要提供文档内容

base64 编码为空或文件缺失。请在对应的“输入数据类型”字段中提供内容。

“无效的 URL 格式”

查看 文档 URL 是一个完整有效的 URL (方案 + 主机 + 路径)。

"GetAnalyzerId 没有返回任何分析器选项"

帐户上没有分析器,或者存在凭据问题。请在帐户中创建分析器。 PDF4me 仪表盘或验证 API 关键在于 n8n 凭证。

速查表

场地价值
ResourceExtract
OperationAI Document Parser
Input Data TypeBinary Data
Input Binary Fielddata
Document Nameform.pdf (with the real extension)
AI Analyzer Id(pick from the dropdown loaded from your account)
CredentialsPDF4me API credential

常见问题解答

Where does the AI Analyzer Id list come from?+
The dropdown is populated from your PDF4me account via the GetAnalyzerId API. Each option is an Analyzer you created at https://dev.pdf4me.com/dashboard/#/ai-document-parser/ with schemas on https://dev.pdf4me.com/ai-document-parser/?id=<analyzer-guid>. The node sends the selected value as customisationNote to the AiDocumentParser API.
What does "GetAnalyzerId returned no analyzer options" mean?+
The account has no Analyzers configured, or the credentials cannot reach the GetAnalyzerId endpoint. Open https://dev.pdf4me.com/dashboard/#/ai-document-parser/ and create at least one Analyzer (Parse or Classify) on the Analyzer detail page, or verify the API key in your n8n credential.
How is this different from AI-Invoice Parser, AI-Process Contract, AI-Process Bank Cheque?+
Those nodes use fixed schemas tuned to those document types. AI Document Parser is schema-driven: it runs whatever Analyzer you select, so the same node handles invoices, purchase orders, receipts, custom forms, lab reports, anything you describe in a schema. Pick AI Document Parser whenever you need a custom layout or document type.
What shape does the output have?+
Top-level keys match the field names in your Analyzer schema (for example customerName, invoiceNumber, totalAmount, lineItems). Nested objects and table arrays follow the same shape you defined. A _metadata object is always appended with success, message, processingTimestamp, sourceFileName, aiAnalyzerId, and operation. No binary file is returned.
Does this work on scanned PDFs?+
Yes. The AI engine handles OCR internally, so scanned PDFs and image formats work the same as native PDFs. If borders are large, chain AI Auto Crop Document (Resource AI) before this node for cleaner extraction.
Can I change the Analyzer schema without rebuilding the workflow?+
Yes. The workflow only references the Analyzer Id. Edit the schema in the PDF4me dashboard and the next run picks up the new shape automatically. Output keys follow your latest schema, so any downstream Set / Code / Sheets nodes that assume specific keys may need updating after a breaking schema change.
Can I switch between Parse and Classify Analyzers without rewiring the node?+
Yes. Both Analyzer types are listed in the AI Analyzer Id dropdown. Pick a Classify Analyzer when you want one node to handle several document variants; pick a Parse Analyzer for a single fixed schema. The output shape adapts to whichever you choose.
What happens when the API returns plain text instead of JSON?+
The node tries to parse it; if parsing fails, the response is wrapped as { "rawContent": "<api response string>" } at the top level so the workflow does not break. Useful for inspecting unexpected responses during development.

相关操作

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

获取帮助