跳到主要内容

AI文档解析器使用解析器

本指南涵盖的内容

AI文档解析器。解析 是将 JSON 转换为 JSON 的仪表板设置。 文档模式 进入 人工智能驱动的结构化PDF提取你创建了一个 分析器选择 解析 输入类型,并描述您想要的字段。 字段名字段类型, 和 字段描述AI 会按语义读取文档,因此无需绘制捕获区域或使用正则表达式。保存后,相同的分析器 ID 将从文档中运行。 REST APIMakeZapierPower Automate, 和 n8n

相关博客文章(4)
在 Make 中使用 AI 提取和智能重命名任何 PDF:一个包含 4 个模块的 Dropbox 工作流程,借助 PDF4me AI - 文档解析器
四模块构建场景:从 Dropbox 拉取供应商 PDF 文件,运行 AI 文档解析器(默认发票提取),解析 JSON 提取供应商名称,然后以 vendorName.pdf 为文件名重新上传。真实截图,精确字段值,无需手动输入数据。
阅读帖子
在 Zapier 中使用 AI 重命名供应商发票:Dropbox + PDF4me 的 5 步工作流程
五步 Zap:Dropbox 新建文件 → Dropbox 查找文件 → PDF4me AI 文档解析器 → Zapier 代码运行 JavaScript → Dropbox 上传文件。利用 AI 提取客户姓名并将其用作输出文件名。真实截图,精确字段值,除两行 JSON.parse 代码外,无需其他代码。
阅读帖子
在 Zapier 中按供应商名称重命名所有供应商发票:5 步 Dropbox + PDF4me AI 工作流程
五步搞定应付账款团队。Dropbox 监控您的发票接收文件夹,PDF4me AI 文档解析器从每个 PDF 文件中提取供应商名称,Zapier 代码将解析器的输出转换为可映射的标记,Dropbox 将文件上传回 Dropbox,并将供应商名称作为文件名。本教程中使用的示例供应商发票 (sample-vendor-invoice.pdf) 和实际截图、精确字段值均可下载。
阅读帖子

验证您的设置

AI文档解析器分析器是在以下环境中创建的: PDF4me 开发者控制面板。使用您的帐户登录,然后创建或复制一个 API AI解析器的关键 API 调用引用您在此处构建的分析器的函数。

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

您不容错过的重要事实

解析提取数据;对路由文档进行分类
挑选 解析 当你需要结构化的内容时 JSON 每个已定义字段输出一个值。选择 分类 当您只需要一个类别标签时,这两种分析器类型使用相同的“添加”模态框,但会生成不同的输出格式。
字段描述影响准确性
人工智能依赖于 字段描述 用于查找文档中每个值的字符串。请尽可能具体,并包含别名(例如“销售订单号,有时也写作 SO No.”)。模糊的描述会降低提取质量。
分析器 ID 是稳定的生产参考。
您在“添加”行中输入的字符串(例如) 采购订单解析器)是每个 API 呼叫和自动化模块的使用。请预先选择清晰的命名规则;之后更改命名规则意味着需要重新配置所有指向该模块的工作流程。

步骤 1:在控制面板中打开 AI 文档解析器

  1. 登录 dev.pdf4me.com
  2. 从仪表盘侧边栏点击 AI文档解析器
  3. 列表页面显示所有现有的分析器,包含三列: 分析器 ID分析器类型 (解析或分类),以及 行动
  4. 点击蓝色 + 添加 按下按钮即可启动新的分析器。
PDF4me AI 文档解析器仪表板页面,侧边栏项目“AI 文档解析器”以红色突出显示,主面板标题为“AI 文档解析器”,有一个蓝色的“添加”按钮,以及一个空列表,列标题为“分析器 ID”、“分析器类型”和“操作”。

AI文档解析器列表视图。点击“+添加”创建新的分析器。

步骤 2:选择分析器类型“解析”并为其命名

新行出现,包含三个控件:

  1. 分析器 ID 输入输入任何你能记住的清晰标识符,例如 purchase order parserInvoice Parser v1, 或者 vendor_statement_parser命名格式没有限制。蛇形命名法、驼峰命名法、烤肉串命名法、带空格的普通单词,都一样有效。
  2. 分析器类型下拉菜单。 挑选 解析 (本指南)或 分类 (参见) 分类指南)。
  3. 保存/取消 按钮。“保存”按钮用于创建分析器;“取消”按钮用于放弃该行。
PDF4me AI 文档解析器新增行,分析器 ID 输入框已填充 purchase_order_parser,分析器类型下拉菜单显示“分类”和“解析”选项,默认选择“解析”,右侧有“保存”和“取消”按钮。

添加行:输入分析器 ID,选择解析,然后保存。

命名小贴士: 在名称中包含文档系列(发票解析器采购订单解析器发货单解析器分析器 ID 是下游自动化程序调用的名称;每次将其连接到新平台时,使用清晰的名称都至关重要。任何命名规则或分隔符样式均可。

步骤 3:打开分析器并添加架构

点击新行即可打开详情页面。URL 格式如下:

https://dev.pdf4me.com/ai-document-parser/?id=<your-analyzer-guid>

仪表盘会在您首次打开分析器时生成一个 GUID。将此 URL 添加到书签,以便下次直接跳转到同一个分析器。

详情页面显示:

  • 解析信息 (左图)显示您在步骤 2 中输入的分析器 ID。此面板为只读面板。
  • 模式 (右)默认为空。点击 + 点击右上角的按钮添加架构。
  • 保存更改 (左上角)保存您对此页面所做的任何编辑。
  • 后退返回到 分析器列表
PDF4me AI 文档解析器详情页面,蓝色横幅标题为“AI 文档解析器”,副标题为“使用 AI 自动提取发票数据,快速、准确、结构化输出”,页面包含“返回”按钮、“保存更改”按钮、“解析信息”面板(显示分析器 ID:purchase_order_parser)以及一个空白的“架构”部分(带有一个蓝色加号按钮,用于添加架构)。

分析器详情。点击蓝色“+”按钮添加文档架构。

步骤 4:定义文档模式 JSON

点击后 +一个空白的架构卡片打开。粘贴一个 JSON 具有两个顶级键的对象:

  • description用一句话概括模式提取的内容。人工智能会将此作为整体上下文。
  • fields字段定义数组。每个字段包含:
    • fieldName机器可读名称(不含空格),用作 JSON 答案中的关键点。
    • fieldTypestringnumber, 或者 date驱动解析和验证。
    • fieldDescription人工智能用于查找此字段的自然语言提示。请具体说明。
PDF4me AI 文档解析器模式 1 打开,其中包含一个文档模式编辑器,显示带有描述“从采购订单和销售订单中提取数据”的 JSON 数据,以及一个字段数组,该数组包含 SalesOrderNumber(销售订单号)、AgentName(代理商名称,通常以代理商名称显示)和 DeptCode(部分可见)。编辑器下方是“发票”和“采购订单”快速填充按钮。

带有发票和采购订单模板快速填充按钮的文档架构编辑器。

示例:采购订单模式

{
"description": "Extracting data from purchase orders and sales orders.",
"fields": [
{
"fieldName": "SalesOrderNumber",
"fieldType": "string",
"fieldDescription": "Sales Order Number"
},
{
"fieldName": "AgentName",
"fieldType": "string",
"fieldDescription": "Name of the agent, mostly given as Agent Name."
},
{
"fieldName": "DeptCode",
"fieldType": "string",
"fieldDescription": "Department or cost-centre code printed on the order."
},
{
"fieldName": "OrderDate",
"fieldType": "date",
"fieldDescription": "Date the order was placed. Accept formats like DD/MM/YYYY, MM-DD-YYYY, or written out as 5 June 2026."
},
{
"fieldName": "TotalAmount",
"fieldType": "number",
"fieldDescription": "Grand total of the order in the document's currency, after taxes."
}
]
}

示例:发票模板(使用“发票快速填充”按钮)

{
"description": "Extracting data from supplier invoices.",
"fields": [
{
"fieldName": "InvoiceNumber",
"fieldType": "string",
"fieldDescription": "Unique invoice identifier, sometimes shown as Invoice No. or INV."
},
{
"fieldName": "InvoiceDate",
"fieldType": "date",
"fieldDescription": "Date the invoice was issued."
},
{
"fieldName": "DueDate",
"fieldType": "date",
"fieldDescription": "Date payment is due, sometimes shown as Payment Due or Net Due."
},
{
"fieldName": "VendorName",
"fieldType": "string",
"fieldDescription": "Company name of the supplier or vendor sending the invoice."
},
{
"fieldName": "TotalAmount",
"fieldType": "number",
"fieldDescription": "Grand total in the invoice currency, including taxes."
}
]
}

快速填写按钮(发票、采购订单): 在架构卡的底部。 将它们作为起点 只需单击其中一个即可加载该文档系列的典型架构,然后重命名、精简或扩展字段以匹配您的实际文档。这些预设只是框架,并非最终架构。

包含表字段的模式(嵌套行)

使用 字段类型:"表格" 当您需要提取重复行(例如发票明细或采购订单明细)时,每个表字段都有其自身的嵌套结构。 字段 描述列的数组。

{
"description": "Invoice data extractor",
"fields": [
{
"fieldName": "invoiceNumber",
"fieldType": "string",
"fieldDescription": "Invoice number / bill number / receipt number"
},
{
"fieldName": "invoiceDate",
"fieldType": "date",
"fieldDescription": "Look for labels: 'Invoice Date', 'Bill Date', 'Date', 'Dated', 'Issue Date', 'Doc Date'. If 4 digit year not found then consider 2 digit year at the end of extracted date.",
"fieldMethod": "generate"
},
{
"fieldName": "lineItems",
"fieldType": "table",
"fieldDescription": "All product / service rows from the invoice table. Be careful, sometimes a row can be part of the next item like when description goes over one line, but it's of a single item.",
"fields": [
{
"fieldName": "itemNumber",
"fieldType": "string",
"fieldDescription": "Product number, product id number or product code"
},
{
"fieldName": "hsnCode",
"fieldType": "string",
"fieldDescription": "HSN / SAC code (4 to 8 digit)"
}
]
}
]
}

字段属性

属性必需的?它的作用
fieldNameRequiredThe name of the field and how it will appear in the response JSON.
fieldTypeRequiredThe type of data to extract. One of string, number, date, or table.
fieldDescriptionRequiredNatural-language description of what needs to be extracted and where to find it. Include alternate labels and example formats so the AI matches correctly.
fieldMethodOptional (default extract)How the AI fills the value. extract takes the value verbatim from the document. generate tells the AI to derive or normalise it (useful for dates, computed totals, or cleaned-up IDs). Omit for default extract behaviour.
fieldsRequired when fieldType is tableNested array describing the columns of the table. Each entry takes the same attributes as a top-level field (fieldName, fieldType, fieldDescription, fieldMethod). Cannot itself be table.

字段类型引用

字段类型最适合示例字段描述
stringNames, identifiers, codes, free textCustomer name as printed on the invoice header.
numberAmounts, quantities, tax rates, countsGrand total of the order in the document currency, including taxes.
dateDates, due dates, issue dates, timestampsDate the invoice was issued, accept DD/MM/YYYY and 5 June 2026 formats.
tableRepeated rows (line items, addresses, transactions)All product / service rows from the invoice table. Carries a nested fields array describing the columns.

步骤 5:保存更改并使用分析器

点击 保存更改 在左上角添加设置以保存模式。分析器现已激活,可通过其分析器 ID 从任何平台引用。

使用分析器 API 或自动化呼叫

保存后,同一个分析器可以通过引用在任何平台上运行。您无需在每个平台上重新创建架构。

场地来源目的
AnalyzerId你在步骤 2 中输入的字符串AI解析器用于定位您的模式的稳定标识符。
docName来源 PDF 文件名用于跟踪和错误消息。
docContent来源 PDF 编码为 Base64要从中提取信息的文档。
asyncfalse 对于同步, true 用于民意调查控制响应的传递。

例子 REST 请求正文:

{
"docName": "purchase_order.pdf",
"docContent": "BASE64_ENCODED_PDF_CONTENT",
"AnalyzerId": "purchase_order_parser",
"async": false
}

响应中包含您在“定义”中定义的每个项目的相应字段。 fields路线 JSON 进入任何下游系统: Google SheetsAirtable一个数据库, Excel或者使用 webhook。

常用工作流程

典型的AI解析器模式How a saved Analyzer moves from dashboard to production.
采购订单收件箱 ERP
  1. 一份新的采购订单 PDF 到达受监控的邮箱或上传文件夹。
  2. MakeZapierPower Automate, 或者 n8n 调用 AI 解析器 分析器 ID:purchase_order_parser
  3. 返回 JSON销售订单号代理名称订单日期总金额)映射到你的 ERP 创建订单 API
  4. 系统会使用解析后的订单号向客户发送确认邮件。
发票收件箱到会计电子表格
  1. 发票 PDF 通过 webhook、监视文件夹或共享收件箱到达。
  2. AI解析器被调用时 分析器 ID:invoice_parser (发票快速填写方案)。
  3. 结构化响应(发票编号总金额到期日)作为一行附加到 Google Sheets 或者 Excel 致会计团队。
先分类后解析路由器
  1. 一个受监控的文件夹接收混合文件(发票、采购订单、发货单)。
  2. 分类分析器会将每个文件路由到正确的类别标签。
  3. 根据标签,工作流程会调用匹配的解析分析器(发票解析器采购订单解析器发货单解析器)并将结构化输出写入正确的目标位置。

模式最佳实践

  • 使用描述性语言 fieldDescription 字符串。提及您在实际文档中看到的别名(例如“销售订单号,也称为 SO 编号、订单参考号或 PO 参考号”)。
  • 挑选 fieldType 小心地。 datenumber 给引擎提供解析提示; string 当形状无法预测时,这是备用方案。
  • 保持 fieldName 机器可读(驼峰式或帕斯卡式,无空格)。它显示为 JSON 答案中的关键点。
  • 先从发票或采购订单的快速填充功能开始,然后精简或添加字段。预设值是很好的基准。
  • 在将生产流量投入分析器之前,先用三个真实样本进行测试,包括缺少可选字段、第二页文档和 OCR 衍生文本等极端情况。
  • 版本分析器 ID(在进行重大架构更改时)invoice_parser_v1invoice_parser_v2因此,实时自动化可以按照自己的节奏迁移。

相关行动

使用分类的 AI 文档解析器
同一个仪表盘,每个分析器支持多个模式。适用于单个分析器需要在不同文档变体(客户端 ABC 与客户端 XYZ)之间进行路由的情况。
AI - 文档解析器 Make
使用您保存的解析分析器 ID Make 场景:可将其与任何数据源和存储模块配合使用,在可视化工作流程中运行 AI 数据提取。
AI - 文档解析器 Power Automate
从以下位置运行相同的分析器 Power Automate 流畅自然地连接 SharePointExcelDataverse, 和 Outlook
AI - 文档解析器 n8n
自托管或云 n8n 工作流程。“AI 分析器 ID”下拉菜单会直接从您的帐户加载您保存的分析器。
AI - 文档解析器 Zapier
从 6000 多个 AI 中提取触发器 SaaS 应用程序和 Webhook。在“AI 分析器名称”字段中输入您保存的分析器 ID。

常见问题解答

What is the difference between Parse and Classify in AI Document Parser?+
Parse extracts structured field values from documents using a Document Schema. The response is a JSON object with one value per field you defined. Classify routes a document into one of several categories you defined; the response is a label string. Use Parse when you need data, Classify when you need a routing decision.
How is AI Document Parser different from the older Parse Document templates?+
The older Parse Document setup uses Regex Expression or JavaScript Expression applied to drawn capture areas on a sample PDF. AI Document Parser uses a JSON Document Schema with natural-language field descriptions; the AI engine reads the document semantically rather than by fixed positions. No sample PDF is required when defining an AI Analyzer.
What does fieldDescription do?+
It is the natural-language hint the AI uses to find each field in the document. Be specific and include alternate names ("Sales Order Number, sometimes shown as SO No."). Descriptions are the single biggest factor in extraction accuracy.
Can I add more than one Schema to the same Analyzer?+
Yes. The detail page supports multiple Schemas via the + button. Use this when one Analyzer should handle two related document families (purchase orders and sales orders) with slightly different field sets.
Does the Analyzer Id change after Save Changes?+
No. The Analyzer Id is the string you typed in the Add row in Step 2. It stays stable across edits and is the value every API call and automation module uses. Pick a clear naming convention up front.
Do I need to upload a sample PDF when setting up the Analyzer?+
No. Unlike the older Parse Document templates, the AI Analyzer does not need a sample for setup. You define a Document Schema in JSON; the AI engine applies it to whatever document you send at runtime.
How do I call the Analyzer from the REST API?+
Send docName, docContent (the PDF as Base64), AnalyzerId (the string you typed in Step 2), and async (false for immediate response, true for polling). The response contains one JSON property per field you defined in the Document Schema.
Can the AI Parser handle scanned PDFs?+
Yes, when the PDF has been OCR-processed first. Run the source file through the PDF4me OCR endpoint before sending it to the AI Parser. The schema then extracts from the OCR text layer the same way it would from a native PDF.

获取帮助