Documents from a template and your data.
Design a Word or HTML template once, then merge it with your data to produce finished PDF or Word files — one at a time, or thousands in a single run. No manual editing, no mail-merge add-ins.
Generate Document, on every platform.
Add Generate Document as a native no-code action, or call the same operation from the REST API. Design the template once, then run it everywhere.
Template plus data, in one call.
- Create the template. Start from a
.docxor HTML file and replace every dynamic value with a merge field. Store it in Google Drive, Dropbox, OneDrive or SharePoint. - Prepare the data. Structure your values as JSON, XML or CSV so each key matches a field name in the template. Pass it inline as text or as a data file.
- Call Generate Document. Point the action at the template and the data, choose PDF or Word output, and PDF4me merges the two into a finished file.
- Route the result. Save the output to storage, attach it to an email, or push it into the next step of the same flow — no manual export.
curl -X POST https://api.pdf4me.com/api/v2/GenerateDocumentSingle \
-H "Authorization: Basic YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"templateFileType": "Docx",
"templateFileName": "invoice-template.docx",
"templateFileData": "<base64 template>",
"documentDataType": "JSON",
"documentDataText": "{ \"ClientName\": \"Acme Corp\", \"Total\": \"$3,960\" }",
"outputType": "PDF"
}'Placeholders that do real work.
A PDF4me template is more than find-and-replace. Loop over arrays, total columns, insert images and branch on your data — all inside the document itself.
Variables & merge fields
<<[CustomerName]>>Every placeholder is replaced with the matching value from your data. Names are case-sensitive and work in body text, tables, headers, footers and text boxes.
Read the guideRepeating tables
<<foreach [item in lineItems]>>Loop a table row over an array and PDF4me inserts one row per item — the invoice line-item pattern. Close the loop in the last cell of the row.
Read the guideTotals & enumeration
<<[items.Sum(i => i.price)]>>Aggregate and reshape data right in the template with LINQ-style methods: Sum, Average, Count, Max, OrderBy, Where, GroupBy, Take and more.
Read the guideDynamic images
<<image [companyLogo] -keepRatio>>Insert logos, product photos, charts or signatures from a public URL or a Base64 string, with fit switches for ratio, height, width and size.
Read the guideConditionals & calculations
<<var [total = subtotal + tax]>>Declare variables, run inline math and branch content with if / else and ternaries — running totals, tiered discounts and conditional sections without touching the payload.
Read the guideFormatting
<<[dueDate]:"MMMM dd, yyyy">>Append a .NET format string to any field to control decimals, currency, percentages and dates, so numbers and dates render exactly as your recipients expect.
Read the guideWord, HTML or Excel.
Three ways to author a template, one Generate Document engine behind them. Start from whichever format your design already lives in. Converting an existing Word or Excel file to PDF is the Word & Excel API, not this product.
Word templates
A designed .docx with merge fields. The richest option: loops, LINQ aggregates, images, variables and formatting all in one file. Output PDF or Word.
Read the guideHTML templates
A handlebars-style HTML template merged with JSON, then rendered to PDF. Ideal when your design already lives on the web or needs full CSS control.
Read the guideExcel Populate
Aspose Smart Markers (&=Data.Field) drop straight into an .xlsx workbook. Expand rows, recalculate formulas and populate multiple sheets in one call.
Read the guideEvery document you send, on autopilot.
- Invoices & quotes with line-item tables, running totals and tax rows.
- Contracts & agreements populated from a CRM deal, kept editable as Word for review.
- Certificates & offer letters personalised per recipient from a form or spreadsheet row.
- Reports & statements with charts, grouped sections and dynamic images at scale.

A finished, print-ready document, merged from a template and your data.
Get your documents done.
Build it into your product with the API, automate it with no code, or use the free tools in your browser. No credit card to begin.
curl -X POST https://api.pdf4me.com/v1/ConvertToPdfFree tier · No credit card required