跳到主要内容

在“生成单个文档”中 Zapier

生成单个文档 是一个 Zapier 采取行动 PDF4me 合并一个单词, HTML邮件合并或使用 Google 文档模板 JSON 或者 XML 收集数据以生成一份完整的文档。用它来转换 CRM 在 Zap 中,可以将记录转换为合同,将订单数据转换为发票,或将表单提交转换为证书。

相关博客文章(2)

此操作的作用

PDF4me 生成单个文档 Zap 中,它接受一个模板文件和一组数据,并返回一个合并后的文档。映射 单词, HTMLPDF邮件合并或谷歌文档 模板,提供数据 行内文本数据文件并选择输出格式。非常适合生成合同、创建发票、签发证书、撰写录用通知书,以及任何无需编写合并代码即可将一条记录转换为一份文档的工作流程。

验证您的身份 API 要求

要访问 PDF4me 网站 API每个请求都必须包含正确的身份验证凭据。连接您的 PDF4me 账户只需登录一次 Zapier Zap 中的每个“生成单个文档”步骤都会重复使用它。

您不容错过的重要事实

输入数据格式类型决定了哪些数据字段是必需的。
将其设置为 文本数据文本 成为内联的必填字段 JSON/XML将其设置为 文件数据文件 如果数据文件是从上一步映射而来,则该字段变为必填项。另一个字段将保持隐藏状态,直到您切换开关为止。
模板文件类型不限于 Word/HTML/PDF
下拉菜单还包括 邮件合并 (一个为邮件合并字段而构建的 Word 模板) Google Docs (使用 Google Docs 导出文件作为合并模板),已在实际 Zap 配置中确认。请将此值与模板文件的实际构建方式进行匹配。
运行两次,得到两种输出格式。
一个模板可以为两个不同的“生成单个文档”步骤提供不同的支持。 输出文档类型 数值(例如) PDF 然后 Docx) 通过单个触发器生成锁定副本和可编辑副本。
在 Zapier 的 PDF4me 操作面板中生成文档,显示模板文件、模板文件名、模板文件类型(设置为 PDF)、输入数据格式类型(设置为文本)、数据文本、输入数据类型(设置为 JSON)和元数据字段。

设置操作面板,并将“输入数据格式类型”设置为“文本”,从而显示“数据文本”字段。

参数

必需 Zapier 用户界面: 模板文件、模板文件类型、输入数据格式类型、输入数据类型,以及(取决于输入数据格式类型)数据文本或数据文件。模板文件名、输出文档类型、是否保留 PDF 可编辑以及元数据均为可选。

范围必需的它的作用例子
Template FileRequiredTemplate file to populate. Map it from a previous step (Dropbox, Google Drive, Upload File).template.docx
Template File NameOptionalName for the output file. If left blank, the name is picked from Template File's own filename.contract_template
Template File TypeRequiredFormat of the template: Word, HTML, PDF, Mail Merge (Word built for mail-merge fields), or GoogleDocs (Google Docs export).Mail Merge
Input Data Format TypeRequiredWhether data is supplied as inline text or a file. Text reveals Data Text. File reveals Data File.Text
Data TextConditionalInline JSON or XML string to merge into the template. Required when Input Data Format Type is Text.[{"firstname":"John","lastname":"Adams"}]
Data FileConditionalData file (JSON or XML) mapped from a previous step. Required when Input Data Format Type is File.data.json
Input Data TypeRequiredStructure of the supplied data, must match Data Text or Data File exactly.Json
Output Document TypeOptionalFormat of the generated document: Pdf, Docx, and other supported formats.Pdf
Keep Pdf EditableOptionalWhen the output is a PDF from a fillable template, keeps its form fields interactive instead of flattening them.false
Meta DataOptionalMetadata to attach to template fields during generation.-

输出

场地类型它包含什么
File NameStringFile name of the generated document, without extension.
File ExtensionStringExtension of the output document, matching Output Document Type.
Full File NameStringComplete filename including extension.
File URLStringDirect URL to the generated document, map this into an Upload File, email, or storage step.
File SizeNumberSize of the generated document in bytes.

如何在“生成单个文档”中设置 Zapier

  1. 添加 PDF4me 选择 Zap 中的操作应用程序并进行选择 生成文档
  2. 连接您的 PDF4me 创建一个帐户或选择现有连接。
  3. 地图 模板文件 从上一步开始并设置 模板文件类型 为了匹配它(Word, HTMLPDF(例如邮件合并或 Google 文档)。
  4. 输入数据格式类型文本 并填充 数据文本 内联 JSON/XML或者将其设置为 文件 和地图 数据文件 从上一步开始。
  5. 输入数据类型JSON 或者 XML 与您的数据实际格式相匹配。
  6. (可选) 输出文档类型保持PDF可编辑然后测试该步骤。
  7. 映射返回结果 文件 URL 将生成的文档上传到 Gmail 或存储操作中以进行交付。

典型配置

工作流程示例Common Zapier patterns using Generate Document Single.
邮件合并模板 JSON 数据文件
  1. 一个新文件(Word 模板)被放入受监控的 Dropbox 文件夹中。
  2. “查找文件”步骤会找到匹配的文件。 JSON 数据文件位于同一文件夹中。
  3. 使用模板文件类型“邮件合并”生成单次文档,输入数据格式类型“文件”,数据文件来自查找步骤,输入数据类型“Json”。
  4. “上传文件”步骤会将生成的文档保存回 Dropbox。
Google 文档模板,内嵌式 JSON双输出
  1. “查找文件”步骤会找到导出为 .docx 格式的 Google 文档模板。
  2. 使用模板文件类型 Google Docs、输入数据格式类型文本、数据文本作为内联方式生成单次文档。 JSON 数组,输出文档类型为Pdf。
  3. 第二个“生成单个文档”步骤重用相同的模板,输入数据格式类型为“文件”,输出文档类型为“docx”,生成一个可编辑的副本以及一个可编辑的副本。 PDF
CRM 由 webhook 触发的记录到合同的转换。
  1. Webhooks Zapier 触发器从……接收来自……的新交易有效载荷 CRM
  2. 格式化步骤将有效载荷格式化为所需格式。 JSON 合同模板要求的结构。
  3. 生成文档单次运行,模板文件类型为 Word,输入数据格式类型为文本,格式化步骤中的数据文本,输入数据类型为 Json,输出文档类型为 Pdf。
  4. Gmail 步骤会将生成的合同通过电子邮件发送给客户。
HTML 轻量级证书模板
  1. 课程完成触发事件由学习管理 webhook 发出。
  2. 使用模板文件类型生成单次运行的文档 HTML输入数据格式类型为文本,数据文本包含学习者姓名、课程和日期,输出文档类型为PDF。
  3. “上传文件”步骤会将证书保存到学员共享的驱动器文件夹中。

实用技巧

Match Template File Type to how the template was built
Word for a plain merge-field .docx, Mail Merge for a template designed around the mail-merge field pattern, GoogleDocs for a Google Docs export. Picking the wrong type can leave placeholders unfilled.
Toggle Input Data Format Type before filling in data
Data Text and Data File are mutually exclusive: only the field matching your Input Data Format Type selection is required. The other stays out of the way.
Input Data Type must match your data exactly
Json for JSON data, Xml for XML data. A mismatch causes template fields to bind incorrectly or come back empty.
Run twice for two formats from one template
Set Output Document Type to Pdf in one step and Docx in a second step using the same template and data to get both a locked and an editable copy.
Use Keep Pdf Editable only for fillable-PDF templates
This toggle only matters when the template is itself a fillable PDF and the output is Pdf. It has no effect on Word, HTML, or Mail Merge templates.
Batch runs need Generate Documents Multiple, not this action
This action produces one document per run. To generate many personalized documents from one template and a list of records in a single step, use Generate Documents Multiple instead.

速查表

场地价值
ActionGenerate Document
Template FileFrom a previous step
Template File TypeWord / HTML / PDF / Mail Merge / GoogleDocs
Input Data Format TypeText or File
Data TextRequired when Input Data Format Type is Text
Data FileRequired when Input Data Format Type is File
Input Data TypeJson or Xml
Output Document TypePdf, Docx, and other supported formats
Keep Pdf Editablefalse (default behavior in documented workflows)

我应该使用什么来代替“生成单个文档”?

如果您的工作流程需要从同一个模板生成多个个性化文档,并在一次运行中生成记录列表,而不是每次 Zap 运行生成一个文档,请使用 生成多个文档如果您的模板是可填写的 PDF 使用表单而不是 Mustache/合并字段模板。 填写 PDF 形式 直接填充其 AcroForm 字段,而不是通过模板引擎运行。

常见问题

What is the difference between Data Text and Data File?+
Input Data Format Type controls which field is required. Text reveals Data Text for inline JSON or XML, useful when a prior step already exposes the data as text such as a webhook body or a Formatter step output. File reveals Data File for a data file mapped from a previous step, such as a downloaded JSON file. Only the field matching your selection is required at a time. See <a href="https://zapier.com/blog/create-documents-from-templates/" target="_blank" rel="noopener noreferrer">Zapier's own guide on building documents from templates</a> for background on template-merge workflows.
What template types does Generate Document Single support?+
Template File Type accepts Word (.docx with mustache or merge-field placeholders), HTML (.html with template placeholders), PDF (a PDF layout template), Mail Merge (a Word template built around the mail-merge field pattern), and GoogleDocs (a Google Docs export used as a merge template). Match this value to how the template file was actually authored.
What does Keep Pdf Editable do?+
Keep Pdf Editable applies only when the output is a PDF generated from a fillable-PDF template. Left off, the generated PDF is a static, completed document. Turned on, it preserves interactive form fields in the output so a recipient can still edit values after the document is generated.
What output formats can Generate Document Single produce?+
Output Document Type sets the generated file's format independently of the template format, options include Pdf and Docx among other supported formats. Running the same template through the action twice with different Output Document Type values produces both a PDF and a Word copy from one source, a pattern documented in PDF4me's own Zapier trigger workflows.
Do I need to specify Input Data Type as Json or Xml?+
Yes. Input Data Type is required and must match the actual structure of the data supplied in Data Text or Data File. A mismatch, such as selecting Json for XML-formatted data, causes the template engine to fail to bind fields and the generated document returns with placeholders unfilled. For background on JSON structure basics, see <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON" target="_blank" rel="noopener noreferrer">MDN's JSON reference</a>.

相关操作

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

行业应用案例及应用

  • 合同生成:根据客户数据,从模板创建个性化合同
  • 法律文件创建生成包含案件特定信息的法律文件
  • 协议处理利用动态数据集成实现协议自动创建
  • 文档自动化利用模板处理简化法律文件工作流程

获取帮助