HTML to PDF API

Generate production-ready PDFs from URLs, raw HTML, and templates with PDFCrowd's HTML to PDF API. Use an official SDK, or call the API directly from your backend.

PHP Java .NET Python Node.js Ruby Go Command Line API WebSave WordPress Zapier Make (formerly Integromat) Postman Bubble Integrately Appy Pie Pipedream Activepieces Pabbly

API Code Preview

# install: "pip install pdfcrowd"
import pdfcrowd

api = pdfcrowd.HtmlToPdfClient("your_username", "your_apikey")

# HTML string to PDF
html = "<h1>Hello</h1>"
api.convertStringToFile(html, "html.pdf")

# URL to PDF
api.convertUrlToFile("https://example.com", "url.pdf")
// install: "composer require pdfcrowd/pdfcrowd"
require "pdfcrowd.php";

$api = new \Pdfcrowd\HtmlToPdfClient("your_username", "your_apikey");

// HTML string to PDF
$html = "<h1>Hello</h1>";
$api->convertStringToFile($html, "html.pdf");

// URL to PDF
$api->convertUrlToFile("https://example.com", "url.pdf");
// install: "npm install pdfcrowd"
var pdfcrowd = require("pdfcrowd");
var api = new pdfcrowd.HtmlToPdfClient("your_username", "your_apikey");

// HTML string to PDF
var html = "<h1>Hello</h1>";
api.convertStringToFile(html, "html.pdf",
    function(err, fileName) { /* done */ });

// URL to PDF
api.convertUrlToFile("https://example.com", "url.pdf",
    function(err, fileName) { /* done */ });
# HTML string to PDF
curl --user "your_username:your_apikey" \
  --form-string "text=<h1>Hello</h1>" \
  --output "from-html.pdf" \
  https://api.pdfcrowd.com/convert/24.04/

# URL to PDF
curl --user "your_username:your_apikey" \
  --form "url=https://example.com" \
  --output "from-url.pdf" \
  https://api.pdfcrowd.com/convert/24.04/
// Maven: https://search.maven.org/artifact/com.pdfcrowd/pdfcrowd/
import com.pdfcrowd.*;

Pdfcrowd.HtmlToPdfClient api =
    new Pdfcrowd.HtmlToPdfClient("your_username", "your_apikey");

// HTML string to PDF
String html = "<h1>Hello</h1>";
api.convertStringToFile(html, "html.pdf");

// URL to PDF
api.convertUrlToFile("https://example.com", "url.pdf");
// nuget install -OutputDirectory packages Pdfcrowd.Official
pdfcrowd.HtmlToPdfClient api =
    new pdfcrowd.HtmlToPdfClient("your_username", "your_apikey");

// HTML string to PDF
string html = "<h1>Hello</h1>";
api.convertStringToFile(html, "html.pdf");

// URL to PDF
api.convertUrlToFile("https://example.com", "url.pdf");
# install: "gem install pdfcrowd"
require "pdfcrowd"

api = Pdfcrowd::HtmlToPdfClient.new("your_username", "your_apikey")

# HTML string to PDF
html = "<h1>Hello</h1>"
api.convertStringToFile(html, "html.pdf")

# URL to PDF
api.convertUrlToFile("https://example.com", "url.pdf")
// install: "go get github.com/pdfcrowd/pdfcrowd-go"
import ("github.com/pdfcrowd/pdfcrowd-go")

api := pdfcrowd.NewHtmlToPdfClient("your_username", "your_apikey")

// HTML string to PDF
html := "<h1>Hello</h1>"
api.ConvertStringToFile(html, "html.pdf")

// URL to PDF
api.ConvertUrlToFile("https://example.com", "url.pdf")

Documentation & Libraries

Use the HTTP API directly, or choose an official SDK for your language. Each SDK wraps the same API and handles common integration details.

Core Features

Layout

  • Headers and footers
  • Page size and margins
  • Page breaks control

Dynamic content

  • JavaScript and CSS injection
  • Viewport width control
  • Convert from URL, HTML file, or HTML string

Output & Security

  • Watermarks
  • PDF password protection
  • 100+ configuration parameters

Sample PDFs

JavaScript Chart
Business Invoice
Magazine Article

Use Cases

  • Report exports
  • Archiving web content
  • Invoice generation
  • Document workflows
  • Certificates & tickets
  • Marketing materials
  • Product catalogs
  • Legal documents
  • Data sheets