HTML to PDF API

Convert URLs, raw HTML, and templates into production-ready PDFs from any backend.

From application content to PDF

Web pages, HTML and CSS, and data templates flow through the HTML to PDF API and return a PDF.

Convert HTML or a URL to PDF with one API call

Send an HTML file or a webpage URL and save the generated PDF.

# HTML file to PDF
curl --user "demo:demo" \
  --form "file=@document.html" \
  --output "from-file.pdf" \
  https://api.pdfcrowd.com/convert/24.04/

# URL to PDF
curl --user "demo:demo" \
  --form "url=https://example.com" \
  --output "from-url.pdf" \
  https://api.pdfcrowd.com/convert/24.04/
# install: "pip install pdfcrowd"
import pdfcrowd

api = pdfcrowd.HtmlToPdfClient("demo", "demo")
api.convertFileToFile("document.html", "html.pdf")
api.convertUrlToFile("https://example.com", "url.pdf")
// install: "composer require pdfcrowd/pdfcrowd"
require "pdfcrowd.php";

$api = new \Pdfcrowd\HtmlToPdfClient("demo", "demo");
$api->convertFileToFile("document.html", "html.pdf");
$api->convertUrlToFile("https://example.com", "url.pdf");
// install: "npm install pdfcrowd"
var pdfcrowd = require("pdfcrowd");
var api = new pdfcrowd.HtmlToPdfClient("demo", "demo");

function done(err, fileName) { /* handle the result */ }
api.convertFileToFile("document.html", "html.pdf", done);
api.convertUrlToFile("https://example.com", "url.pdf", done);
import com.pdfcrowd.*;

Pdfcrowd.HtmlToPdfClient api =
    new Pdfcrowd.HtmlToPdfClient("demo", "demo");
api.convertFileToFile("document.html", "html.pdf");
api.convertUrlToFile("https://example.com", "url.pdf");
pdfcrowd.HtmlToPdfClient api =
    new pdfcrowd.HtmlToPdfClient("demo", "demo");
api.convertFileToFile("document.html", "html.pdf");
api.convertUrlToFile("https://example.com", "url.pdf");
# install: "gem install pdfcrowd"
require "pdfcrowd"

api = Pdfcrowd::HtmlToPdfClient.new("demo", "demo")
api.convertFileToFile("document.html", "html.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("demo", "demo")
api.ConvertFileToFile("document.html", "html.pdf")
api.ConvertUrlToFile("https://example.com", "url.pdf")

Use a URL or send the HTML directly

Convert an existing webpage by URL, send the HTML and CSS your application already generates, or render a data-driven template.

Running a browser renderer in production means packaging and updating the browser, managing workers and memory, and investigating rendering changes. PDFCrowd handles the renderer. Your application keeps control of the HTML, data, business rules, and what happens to the returned PDF.

Control the PDF output

Page composition

  • Page size, orientation, and margins
  • Page breaks, headers, footers, and page numbers
  • Print CSS and additional custom CSS

Dynamic content

  • Custom JavaScript and readiness controls
  • Viewport and responsive-layout behavior
  • Remote fonts, images, and protected content

PDF requirements

  • Watermarks and password protection
  • PDF/A archival output
  • Tagged PDF output

Common uses

  • Reports and dashboard exports
  • Invoices and statements with custom HTML/CSS layouts
  • Proposals, letters, certificates, and tickets
  • Archived pages and print-ready snapshots

Example PDFs

Report with a JavaScript chart
Custom invoice rendered from HTML and CSS
Web article rendered as PDF

Other PDFCrowd products and tools

Use the HTML to PDF API when your backend sends the URL or HTML and decides when to create the PDF. For different inputs or triggers, use one of these products or tools.

WebSave as PDF

Let website visitors save the page they are viewing as PDF.

Invoice PDF API

Generate invoices from structured billing data and a predefined invoice model. Use the HTML to PDF API for fully custom HTML/CSS invoice layouts.

Ready to generate PDFs from your application?

Try the API with your own HTML.