跳到主要内容

批量生成文档 - 批量创建工具 Zapier

PDF4me 生成多个文档 是一个 Zapier 将一个模板与一个 JSON 或者 XML 数组,单次运行即可为每个数组元素生成一份个性化文档。可用于批量处理合同、发票、证书或信函。返回一个文档数组,供下一个 Zap 步骤或循环使用。

此操作的作用

只需一个词, HTMLPDF使用邮件合并或 Google Docs 模板以及一个数据数组(其中每个对象代表一个文档的字段值),然后对数组中的每个元素运行一次相同的合并操作。结果是一个生成的文档数组,这些文档共享相同的模板和输出格式,可以随时使用循环遍历。 Zapier 用于对单个文档执行操作,例如发送电子邮件或存档。

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

验证您的身份 API 要求

要访问 PDF4me 网站 API 通过 Zapier每个请求都必须包含正确的身份验证凭据。身份验证可确保通信安全,并验证您作为授权用户的身份,从而实现与您的系统之间的无缝集成。 Zapier 工作流程和 PDF4me的批量文档生成服务。

您不容错过的重要事实

输出结果是一个数组,而不是单个文件。
使用 循环 Zapier 完成此步骤后,逐个处理生成的文档。
输入数据格式类型决定了哪些数据字段是必需的。
将其设置为“文本和数据”后,内联文本将成为必填项。 JSON/XML 将其设置为“文件”,则需要使用“数据文件”来存储从上一步映射而来的数组数据文件。
批次中的每个文档都使用相同的模板和输出格式。
模板文件类型和输出文档类型每次运行只应用一次,而不是每个数组项都应用一次。文档之间只有每个数组对象中的字段值不同。
PDF4me 在 Zapier 操作面板中生成文档,显示模板文件、模板文件名、模板文件类型(设置为 PDF)、输入数据格式类型(设置为文本)、数据文本、输入数据类型(设置为 Json)和元数据。
设置操作面板:仅需要“模板文件”、“模板文件类型”、“输入数据格式类型”和“输入数据类型”;当“输入数据格式类型”为“文本”时,“数据文本”变为必需。

批量生成文档的主要功能有哪些?

  • 批量生成文档:使用单个模板,在一次操作中为每个数组项创建一个文档
  • 多格式模板支持: 单词, HTMLPDF邮件合并和 Google 文档模板
  • 数组数据输入JSON 或者 XML 数组,以内联文本或映射文件的形式提供
  • 可配置输出:选择整个批次的输出文档类型(Pdf、Docx 和其他支持的格式)

参数

“生成多个文档”操作的完整参数列表。参数名称与以下内容匹配: Zapier 上图所示为配置界面。

快速设置清单
  1. 地图 模板文件 并设置 模板文件类型 为了与之匹配
  2. 输入数据格式类型 保存到文本或文件,然后填写 数据文本 或者 数据文件 与一个 JSON/XML 数组(每个文档一个对象)
  3. 输入数据类型 以匹配数组格式,并可选择性地设置 输出文档类型
范围必需的它的作用例子
Template FileRequiredTemplate file for generating documents. Supports Word (.docx), HTML, PDF, Mail Merge, or GoogleDocs templates.contract_template.docx
Template File NameConditionalName for the output files. If not provided, the name is picked from Template File.contract_template
Template File TypeRequiredFormat of the template: Word, HTML, PDF, Mail Merge, or GoogleDocs.Word
Input Data Format TypeRequiredWhether the data array is supplied as inline text or a file. Text reveals Data Text. File reveals Data File.Text
Data TextConditionalInline JSON or XML array, one object per document to generate. Required when Input Data Format Type is Text.[{"firstname":"John"},{"firstname":"Jane"}]
Data FileConditionalArray data file (JSON or XML) mapped from a previous step. Required when Input Data Format Type is File.customers_data.json
Input Data TypeRequiredStructure of the supplied array, must match Data Text or Data File exactly.Json
Output Document TypeConditionalFormat applied to every generated document in the batch: Pdf, Docx, and other supported formats.Pdf
Meta DataConditionalMetadata to attach to template fields during generation.-

重要的: 必需 Zapier 用户界面: 模板文件模板文件类型输入数据格式类型输入数据类型,并且(取决于输入数据格式类型) 数据文本 或者 数据文件模板文件名、输出文档类型和元数据是可选的。

什么是“生成多个文档”?

PDF4me 生成多个文档 action 返回一个生成的文档数组,每个条目对应输入数据数组中的一个项目。

场地类型它包含什么
File NameStringFile name of each generated document, without extension.
File ExtensionStringExtension of each output document, matching Output Document Type.
Full File NameStringComplete filename including extension for each document.
File URLStringDirect URL to each generated document.
File SizeNumberSize of each generated document in bytes.

笔记: 输出结果为 文档数组每个输入数组项对应一个值。添加 循环 Zapier 完成此步骤后,遍历每个生成的文档。

例子 JSON 响应(文档数组)

[
{
"File Name": "document_001",
"File Extension": ".pdf",
"Full File Name": "document_001.pdf",
"File URL": "https://...",
"File Size": 125440
},
{
"File Name": "document_002",
"File Extension": ".pdf",
"Full File Name": "document_002.pdf",
"File URL": "https://...",
"File Size": 127680
}
]

典型配置

工作流程示例Common Zapier workflow patterns using Generate Documents Multiple.
批量生成合同
  1. 当一批客户记录准备好生成合同时,触发器就会触发。
  2. 格式化步骤构建 JSON 数组,每个客户合同变量对应一个对象。
  3. PDF4me 生成文档多个映射将合同模板和数组转换为数据文本,并将输出文档类型设置为 Pdf。
  4. 循环 Zapier 遍历返回的数组,并通过电子邮件向每位客户发送他们的合同。
批量发票运行
  1. 计费周期触发器会在周期结束时触发。
  2. 会计或电子商务步骤会将每个客户的发票数据导出为一个数组项。
  3. PDF4me “生成文档(多个)”会针对数组运行发票模板,生成一个文档。 PDF 每位顾客。
  4. 循环 Zapier 将每张发票附加到发送给该客户的电子邮件步骤中。
课程学员证书批次
  1. 当培训计划将某个培训班标记为已完成时,就会触发一个触发器。
  2. 该数组由每位参与者的姓名和完成日期构成。
  3. PDF4me “生成文档”多次运行证书模板,模板文件类型为“邮件合并”,针对数组进行操作。
  4. 循环 Zapier 将每个证书存储在学习管理或存档步骤中。

实用技巧

The output is an array, plan for a loop
Map "File URL" through Looping by Zapier rather than expecting a single downloadable file directly from this step.
Only one of Data Text or Data File is required
Set Input Data Format Type first, it determines which of the two fields becomes required and hides the other.
Input Data Type must match your actual array format
Selecting Json for an XML array, or the reverse, causes the template engine to fail to bind fields correctly across the whole batch.
Output Document Type applies to the whole batch
You cannot mix output formats within one run, every document in the array uses the same Output Document Type.
Large arrays mean more Zap tasks
Each generated document and each loop iteration counts toward your Zapier task usage, factor batch size into plan limits.

速查表

场地价值
ActionGenerate Documents Multiple
Template File[Mapped from previous step]
Template File TypeWord / HTML / PDF / Mail Merge / GoogleDocs
Input Data Format TypeText (or File)
Data Text[{"firstname":"John"},{"firstname":"Jane"}]
Input Data TypeJson
Output Document TypePdf

常见问题

How do I generate multiple documents from one template in Zapier?+
Add the PDF4me Generate Documents Multiple action to a Zap, map a Template File and set Template File Type, then provide a JSON or XML array with one object per document in Data Text or Data File. The action returns one generated document per array item.
What is the difference between Generate Documents Multiple and Generate Document Single?+
Generate Document Single merges a template with one JSON or XML object and returns one document. Generate Documents Multiple merges the same template with an array of objects and returns an array of documents, one per array item. See Generate Document Single for the one-document version.
How do I process each generated document separately?+
The action returns an array, not a single file. Add Looping by Zapier after this step to iterate through the array and run one or more actions, such as sending an email or uploading a file, once per generated document.
Do I need to supply Data Text or Data File?+
Only one, depending on Input Data Format Type. Set it to Text to make Data Text required for an inline JSON or XML array, or to File to make Data File required for an array data file mapped from a previous step.
Can I control the output format of the generated documents?+
Yes. Output Document Type sets the format, such as Pdf or Docx, applied to every document in the batch. All documents in one run share the same output format.

相关操作

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

行业应用案例及应用

  • 批量合同生成为客户入职创建多个个性化合同
  • 法律通知分发为多个收件人生成定制的法律通知
  • 协议处理:自动批量创建包含客户特定条款的协议
  • 文档自动化利用批量处理简化法律文件工作流程

获取帮助