PDF Tool
HTML Conversion

HTML to PDF API
for Web Content

Convert HTML pages and CSS styling into professional PDF documents. Perfect for web archiving, documentation, reports, and print-ready files. No browser automation required.

Full CSS Support Multiple Page Sizes Multi-page Documents

What Is HTML to PDF?

A fast, reliable API that converts static HTML and CSS into high-quality PDF documents. Send your HTML content, receive a downloadable PDF—perfect for archiving web content, generating reports, or creating print-ready files.

Standard HTML & CSS

Use the same HTML and CSS you know. No special syntax or proprietary markup required.

Fast Conversion

Server-side rendering with mPDF engine. No headless browsers, no JavaScript execution delays.

Images & Media

Embed images via HTTPS URLs or data URIs. Supports PNG, JPEG, and GIF formats.

Flexible Page Sizes

A4, Letter, and Legal sizes in both portrait and landscape orientations.

HTML In, PDF Out

Send your HTML and CSS, receive a professional PDF in seconds.

API Request
REQUEST
POST https://api.nisastack.com/pdf/html-to-pdf

{
  "html": "<h1>Project Documentation</h1>
    <p>This document contains technical
    specifications for the project.</p>
    <img src='https://example.com/logo.png'>
    <table>...</table>",

  "css": "h1 {
      color: #2563eb;
      font-size: 32px;
    }
    p {
      line-height: 1.6;
      color: #333;
    }
    table {
      border-collapse: collapse;
      width: 100%;
    }",

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

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

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

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

  "size_bytes": 123456,

  "page_count": 3,

  "pdf_base64": "JVBERi0xLjQKJeLjz9MK..."
}
                            
Multiple access methods:
1. download_url - Authenticated download requiring your API token
2. signed_url - Public temporary URL (24-hour default)
3. pdf_base64 - Base64 string for inline embedding (files under 500KB)

Common Use Cases

Convert any HTML content into print-ready PDFs from your automation workflows.

Web Page Archiving

Archive blog posts, articles, or web pages as PDFs. Perfect for creating offline copies or long-term storage.

Preserve formatting
Include images
Maintain styles

Technical Documentation

Convert API docs, user guides, or technical specifications into shareable PDF documents.

Code blocks
Syntax highlighting
Table of contents

Print-Ready Reports

Generate printer-friendly versions of dashboards, analytics reports, or data visualizations.

Chart images
Data tables
Print optimization

HTML to PDF vs JSON to PDF

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

This Tool

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
Alternative

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
Learn about JSON to PDF

Powerful & Flexible

Enterprise-grade PDF generation with the features you need.

Page Formats

A4 (210 × 297 mm)
ISO standard size
Letter (8.5 × 11 in)
North American 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

Convert HTML to PDF Today

Fast, reliable HTML to PDF conversion costs just 3 actions per file. Start with 100 free actions per month—no credit card required.

3 actions per PDF Full CSS styling support Cancel anytime