VaultPDF is built for teams that need reliable, production-grade PDF generation on Microsoft's Power Platform. Whether you're generating sales orders, contracts, or compliance reports, VaultPDF handles the heavy lifting so your flows stay clean.
What You'll Build
In this guide, we'll walk through:
- Creating your first PDF template in the VaultPDF Designer
- Calling VaultPDF from a Power Automate cloud flow
- Handling the response in TypeScript
- Storing the result in SharePoint or Dataverse
Prerequisites
Before you begin, make sure you have:
- A VaultPDF account (free tier works for this tutorial)
- A Power Automate environment with Dataverse enabled
- The VaultPDF custom connector imported into your tenant
Step 1: Create a Template
Every PDF starts with a template — a JSON document that defines layout, fonts, and data bindings.
Open the VaultPDF Designer from your dashboard and create a new template. The Designer gives you a live preview as you drag and drop sections.
{
"templateId": "sales-order-v1",
"pageSize": "A4",
"orientation": "portrait",
"margins": [40, 60, 40, 60],
"defaultStyle": {
"font": "Inter",
"fontSize": 11,
"lineHeight": 1.5
},
"sections": [
{
"type": "header",
"content": "{{company.name}}",
"style": { "fontSize": 18, "bold": true, "color": "#0D1B2A" }
},
{
"type": "table",
"dataSource": "lineItems",
"columns": ["sku", "description", "qty", "price", "total"]
}
]
}
Step 2: Connect Your Data
VaultPDF uses a payload structure to bind live data from Dataverse to your template fields. A typical payload looks like this:
{
"templateId": "sales-order-v1",
"data": {
"company": {
"name": "Contoso Ltd",
"address": "1 Microsoft Way, Redmond, WA 98052"
},
"lineItems": [
{ "sku": "PROD-001", "description": "Enterprise Licence", "qty": 5, "price": 29.99, "total": 149.95 },
{ "sku": "PROD-002", "description": "Support Add-on", "qty": 1, "price": 149.00, "total": 149.00 }
],
"totals": {
"subtotal": 298.95,
"tax": 29.90,
"grand": 328.85
}
}
}
Step 3: Call the API
Send a POST request with your payload. VaultPDF returns a base64-encoded PDF binary.
POST https://api.vaultpdf.io/v1/render HTTP/1.1
Authorization: Bearer vpdf_live_YOUR_API_KEY
Content-Type: application/json
Accept: application/json
{
"templateId": "sales-order-v1",
"data": { "...": "..." }
}
Step 4: Handle the Response in TypeScript
Here's a minimal typed helper you can drop into any Node.js or Azure Function project:
interface VaultPdfResponse {
documentId: string;
sizeBytes: number;
pdf: string; // base64-encoded
generatedAt: string;
}
async function generatePdf(
templateId: string,
data: Record<string, unknown>
): Promise<Buffer> {
const res = await fetch("https://api.vaultpdf.io/v1/render", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VAULTPDF_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ templateId, data }),
});
if (!res.ok) {
const err = await res.json();
throw new Error(`VaultPDF error ${res.status}: ${err.message}`);
}
const { pdf } = (await res.json()) as VaultPdfResponse;
return Buffer.from(pdf, "base64");
}
Step 5: Store in SharePoint with Power Automate
Once you have the base64 PDF, pass it straight into a Create file SharePoint action. Alternatively, configure a deliveryTarget block in your template so VaultPDF handles delivery server-side:
# In your template settings (YAML representation)
deliveryTarget:
type: sharepoint
siteUrl: https://contoso.sharepoint.com/sites/Finance
library: SalesOrders
path: "{{year}}/{{month}}/SO_{{data.order.number}}.pdf"
Step 6: Install the CLI (optional)
If you prefer pushing templates from the command line during development:
# Install the VaultPDF CLI globally
npm install -g @vaultpdf/cli
# Authenticate
vaultpdf login
# Push a template from a local JSON file
vaultpdf templates push ./templates/sales-order-v1.json
# Render a quick test PDF and open it
vaultpdf render --template sales-order-v1 --data ./samples/order.json --open
Next Steps
You've got the basics! Explore the template settings docs to customise page margins, headers, footers, and watermarks — or dive into hierarchical tables for complex nested data.