HTML, CSS & URL Support

Convert HTML to PDF with Full CSS Support

Transform any HTML content into pixel-perfect PDFs. Support for custom CSS, Google Fonts, headers, footers, and page configuration. Send raw HTML, upload files, or provide a URL.

# Convert HTML to PDF
curl -X POST \
  https://api.convertfilefast.com/v2/convert/html-to-pdf \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "<html><body><h1>Invoice #1234</h1><p>Total: $99.00</p></body></html>",
    "css": "body { font-family: Inter, sans-serif; }",
    "options": {"page_size": "A4", "orientation": "portrait"}
}' \
  --output invoice.pdf

# HTTP 200 OK — Content-Type: application/pdf
Conversion completed in <2s

Advantages

Why use our API?

Complete and reliable solution for integration in any tech stack.

Full CSS Support

Renders CSS3, Flexbox, Grid, Google Fonts, and custom stylesheets exactly as designed.

Multiple Input Methods

Send raw HTML string, upload .html file, or provide a public URL to convert.

Custom Page Settings

Configure page size (A4, Letter, A3), orientation, and margins per request.

Headers & Footers

Add recurring headers and footers to every page using CSS Paged Media.

Base64 Image Embedding

Embed logos and images as base64 data URIs for guaranteed rendering.

Production Ready

99.9% uptime, sub-second conversion, auto-scaling infrastructure.

How it works

4 steps to run this conversion

  1. 1

    Create an API key

    Sign up at convertfilefast.com/signup and copy your cff_ API key from the dashboard. The free tier includes 10 conversions per month.

  2. 2

    POST your HTML to the endpoint

    Send a JSON POST to https://api.convertfilefast.com/v2/convert/html-to-pdf with header X-API-Key: cff_your_key and a body containing content (your HTML), an optional css string, and an options object for page_size, orientation, and margins.

  3. 3

    Receive the PDF file

    The response body is the rendered PDF, streamed back with the appropriate Content-Disposition filename. Save it to disk or forward it to the next step in your pipeline.

  4. 4

    Or invoke via MCP for AI agents

    Add the MCP server to Claude, Cursor, or any MCP-compatible client with the URL https://mcp.convertfilefast.com/mcp. Then call convert_file({ source_format: 'html', target_format: 'pdf', source_url: '...' }) as a single tool call — no HTTP client needed.

For AI agents

Or call this from Claude, Cursor, or any MCP client

Convert File Fast ships a native Model Context Protocol server. Give this conversion to an AI agent as a single tool call — no HTTP client, no binary handling, per-user API keys.

Local install
npx -y convertfilefast-mcp
MCP tool call
convert_file({ target_format: "pdf", source_url: "https://example.com/file.html" })

FAQ

Frequently Asked Questions

Does it support modern CSS like Flexbox and Grid?

Yes. The engine is WeasyPrint, a dedicated CSS-to-PDF renderer, and it supports CSS3 including Flexbox and Grid, along with @page rules for page size, orientation, and margins — set via the page_size, orientation, and margin fields in the options object.

Does it render JavaScript or single-page apps?

No. WeasyPrint has no JavaScript engine, so client-rendered content (React/Vue apps, content injected after page load) will not appear in the PDF. Send fully rendered, static HTML — server-side rendered pages or pre-rendered snapshots work well.

How do I call this from an AI agent like Claude or Cursor?

Add the ConvertFileFast MCP server to your client with the URL https://mcp.convertfilefast.com/mcp and your API key. The agent then calls convert_file({ source_format: 'html', target_format: 'pdf', source_url: '...' }) as a single tool invocation, without touching HTTP requests or binary payloads.

Is my HTML content stored on your servers?

No. Content is processed in memory and discarded immediately after the PDF is streamed back. No persistent storage, no training, no third-party sharing.

What's the maximum size for the HTML content?

This endpoint has its own cap on the combined size of the HTML and CSS you send, separate from your plan's file-size limit — there's no file being uploaded, just content in the request body. A request over that cap is rejected with a 400 error whose message states the current ceiling. If you're generating large documents, split them into multiple calls or trim embedded assets.

How is pricing calculated?

Each conversion counts as one unit against your monthly quota. The free plan includes 10 conversions per month. Prepaid credit packs start at $4 for 1,000 conversions ($0.004 each). Subscription plans start at $9/month for 5,000 conversions.

Start Converting HTML to PDF

Get your API key and convert your first HTML document in under a minute. Free plan includes 10 conversions per month.

No credit card. 10 free conversions on Free plan.