Generate Document Single in Power Automate
PDF4me Generate Document Single merges a Word, HTML, or PDF template with JSON or XML data inside a Power Automate flow and produces a personalized PDF, Word, Excel, or HTML file in one action. It replaces multi-step Microsoft 365 mail-merge flows with a single configurable step. Map the template file from any Microsoft 365 storage action (SharePoint, OneDrive, Dataverse, Outlook attachments), supply your data from dynamic content or a mapped file, and pipe the generated File Content straight into Create file, Send email, or any downstream action.
Authenticating Your API Request
The PDF4me Connect connector in Power Automate requires a valid connection holding your PDF4me API key. Create the connection once at flow design time, then every PDF4me action in your tenant reuses it.
Important Facts You Should Not Miss
{{customer.name}}.File Content dynamic-content field. Pass it directly into SharePoint Create file, Outlook Send an email with attachment, OneDrive Create file, Dataverse Add a new row, or Teams Post a message with file..webp)
The Generate Document Single action in a Power Automate flow. Template File Type, Output Type, Template Name, Template, Document DataType, and Document Data Text (or Document Data File) are the fields required for a typical Word-to-PDF run.
Parameters
Required: Template File Type, Output Type, Template Name, Template, Document DataType. Conditional: Document Data Text OR Document Data File (one of the two must carry the data payload). Optional: Meta Data Json.
| Parameter | Required | What it does | Example |
|---|---|---|---|
| Template File Type | Required | Type of the template and the syntax its placeholders use. Options: Docx (PDF4me Template Syntax), Html (Handlebars Syntax), Pdf Form, Docx (Mail Merge), Google Docs. Defaults to `Docx (PDF4me Template Syntax)`. | Docx (PDF4me Template Syntax) |
| Template File Name | Required | Name of the template file, including its extension (for example `invoice-template.docx`). | invoice-template.docx |
| Template File Data | Required | Content of the template file. Map it from the file content returned by a previous action. | @{body('Get_file_content')?['$content']} |
| Document Data Type | Required | Format of the data: Json or XML. Options: Json, XML. Defaults to `Json`. | Json |
| Document Data File | Optional | Content of a file with the data to fill the template with, in the format chosen in Document Data Type. | @{body('Get_file_content')?['$content']} |
| Document Data Text | Optional | Data to fill the template with, as JSON or XML text. Required only if Document Data File is not mapped. | your value |
| Field Metadata | Optional | Metadata for fields in JSON format. | your value |
| Output Type | Required | Format of the generated document. Options: PDF, Docx, Html. Defaults to `Docx`. | Docx |
| Keep Pdf template Editable | Optional | If Yes, the form fields of a PDF template stay editable after they are filled with data. Default: No. Defaults to `No`. | No |
Template File Type options
PDF4me Word Template.docx with mustache placeholders{{customer.name}}, loops, conditionals, tables, and inline images. Best for invoices, contracts, certificates, and letters built in Word.PDF4me HTML Template.html with inline CSSPDF4me PDF TemplateFillable PDF form field replacementOutput Type options
PDFPrint-ready locked layoutWordEditable .docx outputExcelSpreadsheet .xlsx outputHTMLWeb-ready HTMLOutput
The action returns one bundle of dynamic content. The generated file lives on File Content, ready to pass into downstream Microsoft 365 actions.
| Field | Type | What it contains |
|---|---|---|
File Content | File content | Content of the generated document. Map it into the next action, for example the File Content field of SharePoint or OneDrive Create file. |
File Name | Text | File name of the generated document, as returned by PDF4me. Use it as the file name when saving the file. |
Page Count | Text | Page count reported by PDF4me for the processed document. Returned as text; wrap it in int() to use it as a number. |
Flow examples
Common Power Automate flow patternsTypical ways to chain Generate Document Single into a flow.
- SharePoint When an item is created or modified trigger fires on the Invoices list.
- SharePoint Get file content loads the invoice Word template from the Templates library.
- Generate Document Single merges template with list item columns as JSON, Output Type PDF.
- Outlook Send an email attaches File Content to the customer with a thank-you body.
- Microsoft Forms When a new response is submitted trigger fires for course completion.
- OneDrive Get file content loads the certificate Word template.
- Generate Document Single renders the certificate as PDF using the Forms response as JSON.
- SharePoint Create file stores the certificate in the Certificates document library, and Outlook Send an email delivers it to the student.
- Dataverse When a row is added to Deals trigger fires on closed-won opportunities.
- SharePoint Get file content loads the contract template.
- Generate Document Single produces the contract PDF from the deal data.
- Teams Post adaptive card with approval routes File Content to the legal owner for sign-off.