{{-- Hero Section --]]
PDF Tool
Document Generation

JSON to PDF API
for Dynamic Documents

Convert JSON data and HTML templates into beautiful PDF documents. Perfect for invoices, reports, payslips, receipts, and certificates. No design skills required—just HTML, CSS, and data.

Multi-page Documents Custom CSS Styling A4, Letter, Legal Sizes
{{-- What It Does Section --]]

What Is JSON to PDF?

A powerful document generation API that combines HTML templates with dynamic data to create professional PDF documents. Use Mustache template syntax ([[variable]]) to inject data into your designs.

Template-Based

Write HTML templates once, reuse them with different data. Use [[variable]] syntax for dynamic content.

Full CSS Styling

Style your PDFs with standard CSS. Fonts, colors, layouts, borders—full design control.

Image Support

Embed images via URLs or data URIs. Perfect for logos, signatures, and product photos.

Security Built-in

CSS sanitization, SSRF protection, memory limits, and page count restrictions for safe document generation.

{{-- Code Example Section --]]

From Data to PDF in One Request

Send HTML template + CSS + JSON data, receive a professional PDF. It's that simple.

{{-- Request Example --]]
API Request
REQUEST
POST https://api.nisastack.com/pdf/json-to-pdf

{
  "html": "<h1>Invoice #[[id]]</h1>
    <p>Customer: [[customer]]</p>
    <p>Total: $[[amount]]</p>",

  "css": "h1 { color: #333; }
    p { font-size: 14px; }",

  "data": {
    "id": "INV-12345",
    "customer": "Acme Corp",
    "amount": "1,499.99"
  },

  "page_size": "A4",
  "orientation": "portrait"
}
                            
{{-- Response Example --]]
PDF Response
RESPONSE
{
  "download_url": "https://app.nisastack.com/
    files/download/files/123/doc.pdf",

  "signed_url": "https://pub-xxx.r2.dev/
    files/123/doc.pdf?X-Amz-Signature=...",

  "signed_url_expires_at":
    "2026-05-24T15:30:00Z",

  "expires_at": "2026-05-23T15:30:00Z",

  "size_bytes": 45678,

  "page_count": 1,

  "pdf_base64": "JVBERi0xLjQKJeLjz9MK..."
}
                            
Three ways to access your PDF:
1. download_url - Authenticated download via NisaStack
2. signed_url - Temporary public URL (24hr default)
3. pdf_base64 - Base64-encoded PDF (for files under 500KB)
{{-- Use Cases Section --]]

Perfect For

Generate professional documents on-demand from your automation workflows.

Invoices & Receipts

Generate branded invoices with line items, tax calculations, and payment details. Perfect for e-commerce and SaaS platforms.

Dynamic line items
Company logos
Tax calculations

Reports & Analytics

Create data-driven reports with charts, tables, and metrics. Automate monthly reports for clients or stakeholders.

Data tables
Image charts
Multi-page layouts

Certificates & Payslips

Issue completion certificates, employment letters, or payslips with personalized details and signatures.

Personalized names
Signature images
Custom layouts
{{-- Template Example Section --]]

Simple Mustache Template Syntax

Use [[variable]] syntax to inject dynamic data into your HTML templates. No complex templating languages to learn.

INVOICE TEMPLATE EXAMPLE
<!-- HTML Template -->
<div class="invoice">
  <header>
    <h1>Invoice #[[invoice_number]]</h1>
    <p>Date: [[invoice_date]]</p>
  </header>

  <section class="customer">
    <h2>Bill To:</h2>
    <p>[[customer_name]]</p>
    <p>[[customer_address]]</p>
  </section>

  <table>
    <tr>
      <td>[[item_description]]</td>
      <td>$[[item_amount]]</td>
    </tr>
  </table>

  <footer>
    <strong>Total: $[[total_amount]]</strong>
  </footer>
</div>

// JSON Data
{
  "invoice_number": "INV-2024-001",
  "invoice_date": "2024-05-23",
  "customer_name": "Acme Corporation",
  "customer_address": "123 Business St, Suite 100",
  "item_description": "Professional Services",
  "item_amount": "1,499.99",
  "total_amount": "1,499.99"
}
                    
{{-- Comparison: JSON to PDF vs HTML to PDF --]]

JSON to PDF vs HTML to PDF

Both tools use the same powerful PDF engine, but serve different use cases.

This Tool

JSON to PDF

Best for dynamic documents with data-driven templates and variables.

Template-based with [[variable]] syntax
Invoices and receipts
Personalized certificates
Data-driven reports
Alternative

HTML to PDF

Best for converting static HTML content without variables or templates.

Static HTML content (no template variables)
Web page archiving
Documentation snapshots
Print-ready web content
Learn about HTML to PDF
{{-- Technical Specifications --]]

Powerful & Flexible

Enterprise-grade PDF generation with the features you need.

Page Formats

A4 (210 × 297 mm)
International standard
Letter (8.5 × 11 in)
US standard
Legal (8.5 × 14 in)
US legal documents
Portrait or Landscape
Flexible orientation

File Access Options

Authenticated download URL
Temporary public URL (24-hour default)
Base64-encoded for inline embedding
Automatic cleanup after 1 hour

Built-in Security

Secure image loading from HTTPS URLs
Automatic CSS sanitization
Enterprise-grade resource management
Fast processing with smart timeouts
{{-- Pricing CTA Section --]]

Start Generating PDFs Today

Professional document generation costs just 3 actions per PDF. Start with 100 free actions per month—no credit card required.

3 actions per PDF Template-based generation Cancel anytime