跳到主要内容

在“生成单个文档”中 Make

生成单个文档 是一个 PDF4me 模块 Make 它将一个模板与一组数据合并,每次运行返回一个最终文档。它支持五种模板系列(WordHTMLPDF 表单、邮件合并和 Google Docs)和两种数据格式(JSONXML),以及输出 PDFWordExcel, 或者 HTML无需编写代码,即可用于生成发票、合同、证书和个性化信函。

本模块的功能

PDF4me 生成单个文档 合并 WordHTMLPDF邮件合并,或 Google Docs 带有模板 JSON 或者 XML 数据并生成个性化结果 PDFWordExcel, 或者 HTML 一个文件中 Make 该模块将多步骤邮件合并流程替换为单个可配置操作。映射来自任何云存储模块的模板文件(DropboxGoogle DriveOneDrive您可以直接以内联方式或以映射文件的形式提供数据,并通过管道传输生成的数据。 文件日期 直接输出到“上传文件”、“发送电子邮件”或任何下游操作 Make 模块。

相关博客文章(4)
Google 文档模板 + JSON?轻松转换成 PDF 或 Word 文档。只需四步,无需编写任何代码!
使用 Make 从 Google 文档模板生成 PDF 或 Word 文档:Dropbox(模板 + JSON)→ PDF4me 生成文档(模板文件类型:Google 文档)→ 上传。无需编写代码,即可将占位符与数据合并。附带截图的详细步骤。
阅读帖子
Dropbox 中有 Word 模板和 JSON 文件?只需四步,即可在 Make.PDF 或 Word 中运行邮件合并!
在 Make 中实现邮件合并自动化:Dropbox(Word 模板 + JSON)→ PDF4me 生成文档(模板文件类型:邮件合并)→ 上传。将占位符与数据合并,输出 PDF 或 Word 文档。步骤详解,附带截图。
阅读帖子
Dropbox 文件夹中有新文件?使用 Make 运行邮件合并。六步,全自动!
Make 中的触发式邮件合并:当 Dropbox 中出现新文件时,查找 JSON 数据,运行 PDF4me 生成文档(邮件合并)功能,然后上传 Word 和 PDF 文件。附带截图的详细步骤说明。
阅读帖子

选择您的模板类型

选择适合您的指南 模板文件类型每页都列出了确切的示例模板、数据文件(JSONXMLCSV)、推荐字段值以及快速测试场景 Make

验证您的身份 API 要求

每一个 PDF4me 模块 Make 需要有效 联系创建或选择一个可以容纳您的 PDF4me API 关键在于确保该方案能够安全地验证文档生成请求。

您不容错过的重要事实

模板文件类型必须与模板文件匹配
您选择的模板文件类型必须与模板下映射的文件类型相匹配。 .docx 用……映射 HTML 所选类型在运行时失败。请打开上方的匹配指南,查看每个模板系列使用的确切占位符语法。
提供文档数据文本或文档数据文件
文档数据文本接受内联 JSON 或者 XML 它最适合映射自先前模块的短有效载荷。文档数据文件接受来自先前模块的二进制文件。 Make 步骤繁琐,最适合处理大型或预先构建的数据文档。根据具体情况选择使用其中一种方法。
输出结果已保存在文档数据中,可供下一个模块使用。
生成的文件将返回。 文件日期 输出字段。将其直接通过管道传递给上传文件(Dropbox, 驾驶, OneDrive)、发送电子邮件附件,或任何接受二进制文件的下游模块。文件名将保留自“模板名称”字段。
使用 PDF4me 的“使用模板生成文档”模块显示连接信息,模板名称设置为 PDF4me 存储库中的示例模板,文档数据类型为 JSON,文档数据文本为空,文档数据文件已从上一步(步骤 2)映射,元数据 JSON 也为空。

选择一个 模板名称 来自你的 PDF4me 存储库,设置 文档数据类型 转换为 JSON,并进行映射 文档数据文件 从之前的下载步骤(或粘贴) JSON 进入 文档数据文本 反而)。

“生成单个文档”使用了哪些参数? Make

必需 Make UI 连接、模板文件类型、输出类型、模板名称、模板和文档数据类型(均标有红色星号)。 条件: 文档数据文本或文档数据文件(两者之一必须承载数据有效载荷)。 选修的: 元数据 JSON。

范围必需的它的作用例子
ConnectionRequiredPDF4me connection for the scenario. Click Add to create a connection with your API key, or select an existing connection from the dropdown.My PDF4me connection
Template File TypeRequiredSelect the template family: Word Template (.docx), HTML (.html), Pdf Form (fillable .pdf), Mail Merge (.docx merge fields), or Google Docs export (.docx). Open the matching guide for placeholder syntax.PDF4me Word Template
Output TypeRequiredFormat of the generated document. Word for editable .docx, PDF for print-ready locked layout (most common), Excel for .xlsx, HTML for web embedding.PDF
File SelectionRequiredHow the template file is supplied. Choose a storage module shortcut (for example Dropbox Download a File) or select Map to wire Template Name and Template from any prior step.Map
Template NameRequiredTemplate file name including extension. Map from the previous module filename output (shown as 1. File Name when Dropbox Download a File is upstream).1. File Name
TemplateRequiredTemplate file binary for document generation. Map from the previous module data output (shown as 1. Data when Dropbox Download a File is upstream).1. Data
Document Data FileConditionalMap source document file content from a previous action when your data payload is a file rather than inline text. Use when Document Data Text is empty.1. Data
Document DataTypeRequiredChoose document data type. Json for JSON payloads (most common), Xml when the upstream system returns XML.Json
Document Data TextConditionalInput data text to generate the document. Paste JSON or XML inline or build it with Make expressions. Use when Document Data File is empty.{ "Name": "John", "Age": 16 }
Meta Data JsonNoOptional metadata for template fields (title, author, subject, custom properties). Shown without an asterisk in the Make UI. Leave empty for most templates.

如何在输出类型中选择? Make

选择与下游要求相匹配的格式。 Make 模块期望的输出格式与模板类型无关,因此 Word 模板可以生成 PDF

PDFPrint-ready, locked layout
Standard choice for invoices, contracts, certificates, and statements. Send via Email or upload to storage as a final deliverable.
WordEditable .docx output
Use when the recipient needs to edit the generated document such as draft contracts that go back for review or HR letters that need a manual signature line.
ExcelSpreadsheet .xlsx output
Use for data-heavy templates such as financial reports. The template must be designed in Excel and use Excel template variable syntax.
HTMLWeb-ready HTML
Use for emails, web previews, or downstream rendering in a browser-based viewer. Output is a single HTML file.

输出

该模块返回一个 每次执行生成的文件都放置在 文件日期 输出字段,可供下游模块通过标准方式获取。 Make 数据映射。

场地类型它包含什么
Doc DataBinaryThe generated document in the format chosen under Output Type. Map this into a downstream Upload File, Send Email Attachment, or any module that accepts binary input.
File NameStringOutput filename based on Template Name with the extension matching Output Type.
Mime TypeStringMIME type of the generated document (application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document, and so on).

场景示例

常见制造场景模式Typical ways to chain Generate Document Single into a Make flow.
Dropbox 模板 + webhook 数据到电子邮件 PDF
  1. Webhook 接收 JSON 用于开具新发票。
  2. Dropbox 下载文件即可加载发票 Word 模板。
  3. 从单个映射模板名称和模板生成文档单页映射模板名称和模板 Dropbox 该步骤将 DataType 设置为 Json,并读取 webhook。 JSON 转换为文档数据文本。
  4. 发送电子邮件,将文档数据作为附件发送给客户。
Airtable 证书上传至 Google Drive
  1. 每天上午 9:00 定时触发。
  2. Airtable 搜索记录获取最新的课程完成信息。
  3. 迭代器遍历每条记录。
  4. 生成单个文档合并 Word 包含记录数据和输出的证书模板 PDF
  5. Google Drive “上传文件”功能会将每个证书保存到以收件人命名的共享文件夹中。
Google Sheets 月度报告 PDF
  1. 每月1号安排消防活动。
  2. Google Sheets 搜索行提取每月汇总数据。
  3. 转换模块将行转换为 JSON 模板所需的结构。
  4. 生成单个文档会使用数据渲染报表模板,输出类型为 PDF
  5. OneDrive 上传文件存档 PDFSlack 发送消息即可发布下载链接。

常见问题解答

Which template file types does Generate Document Single accept in Make?+
Five template families: PDF4me Word Template (.docx with mustache variables, most common), HTML (file or pasted HTML Code), Pdf Form (fillable .pdf form-field replacement), Mail Merge (Word mail-merge fields), and Google Docs (Google Docs export style .docx). Each has its own setup guide with sample files linked in the Choose your template type section above.
What output formats can the Make module produce?+
Output Type supports Word (.docx for editable output), PDF (locked layout, most common for invoices and contracts), Excel (.xlsx for spreadsheet output), and HTML for web embedding. The output format is independent of the template type, so a Word template can produce a PDF and vice versa.
How do I pass JSON data to the template?+
Set Document DataType to Json, then either paste the JSON object directly into Document Data Text or map a data file from a previous module into Document Data File. Document Data Text is best for small payloads built with Make expressions, Document Data File is best for large or pre-built data documents.
Is Meta Data Json required?+
Meta Data Json is shown without an asterisk in the Make UI, so it is optional in this connector. Use it when your template references document metadata such as title, author, or subject at render time. Leave it empty for most invoice and contract scenarios.
How do I generate many documents in one scenario?+
For one document per record, add a Make Iterator or Search Records loop before Generate Document Single and map each record into the data field. The module runs once per record and returns one file per execution. For true multi-record output in a single call use Generate Documents Multiple instead.
How is this different from the n8n, Zapier, or Power Automate version?+
All four platforms call the same PDF4me Generate Document Single backend. Make is the visual scenario builder, n8n is the developer-friendly self-hosted option, Zapier triggers from 6,000+ SaaS apps, and Power Automate is Microsoft 365 native. The template logic and output format are identical across platforms.

相关行动

获取帮助

有关驱动所有模板系列的模板引擎和 Mustache 语法,请参阅: Aspose Words for .NET 文档 以及 Make 数据结构参考