WeasyPrint Creator & Producer

Understanding PDF metadata that shows WeasyPrint as the Creator or Producer — learn how this open-source Python library converts HTML and CSS into beautiful PDF documents with excellent CSS Paged Media support.

🆓 Open Source (BSD) 🐍 Python Library 📅 Since 2011

📄 About This PDF Metadata

When you examine a PDF file's properties and see WeasyPrint [version] as the Producer, it indicates that the document was generated using WeasyPrint — a Python-based visual rendering engine for HTML and CSS that exports to PDF.

Sample PDF Metadata from WeasyPrint:

Title: Monthly Report

Author: Jane Doe, John Doe

Subject: This is a simple sample

Creator: HTML generator

Producer: WeasyPrint 68.0 (https://weasyprint.org/)

Creation Date: 2025-01-27 14:30:00

Keywords: HTML, CSS, PDF

WeasyPrint automatically reads metadata from HTML elements like <title> and <meta> tags. The Producer field is automatically set to identify WeasyPrint and its version.

PDF Creator

Set with <meta name="generator"> — shows the application that generated the original HTML document.

PDF Producer

Automatically set to WeasyPrint [version] — identifies WeasyPrint as the PDF generation engine.

📚 What is WeasyPrint?

WeasyPrint is a visual rendering engine for HTML and CSS that can export to PDF. Created in 2011 by Simon Sapin at Kozea, it's designed specifically for pagination and print output. Unlike browser-based solutions, WeasyPrint implements its own CSS layout engine written in Python, making it lightweight and easy to integrate. Professional support is now provided by CourtBouillon.

Library Information

Original Author:Simon Sapin
Created By:Kozea
Maintained By:CourtBouillon
First Released:2011
Current Version:68.0 (Jan 2026)

Technical Details

License:BSD 3-clause
Language:Python
Python Version:3.10+
PyPI:pip install weasyprint
Website:weasyprint.org

Why WeasyPrint?

🐍

Pure Python

No browser engine needed — lightweight and easy to integrate

📄

CSS Paged Media

Excellent @page support for headers, footers, page numbers

🆓

Truly Free

BSD license — use in commercial projects without restrictions

💡 WeasyPrint vs Browser-Based Solutions

Unlike wkhtmltopdf or Puppeteer (which use browser engines), WeasyPrint implements its own CSS layout engine designed specifically for pagination. This means no JavaScript execution but excellent CSS Paged Media support, smaller footprint, and easier deployment.

⚙️ How WeasyPrint Creates PDFs

WeasyPrint converts HTML/CSS to PDF using its own rendering pipeline:

PDF Generation Workflow:

1

Parse HTML

HTML5 parser

2

Apply CSS

Cascade & layout

3

Paginate

@page rules, breaks

4

Output PDF

Cairo + Pango

Key Dependencies:

  • Cairo: 2D graphics library for PDF output
  • Pango: Text rendering and font handling (version 1.44.0+)
  • fontTools: Font file parsing (version 4.0.0+)
  • tinycss2, cssselect2: CSS parsing and selection
  • Pillow: Image handling (optional, for raster images)

✨ Key Features

📝 CSS Support

  • CSS 2.1 (passes Acid2 test since v0.11)
  • Selectors Level 3
  • Flexbox layout
  • Multi-column layout
  • CSS Fonts (@font-face)

📄 PDF Variants

  • PDF/A: 1b, 2b, 3b, 2u, 3u, 4u, 1a, 2a, 3a, 4e, 4f
  • PDF/UA: 1, 2 (accessibility)
  • PDF/X: 1a, 3, 4, 5g (print production)
  • CMYK colors and color profiles

📚 Paged Media

  • @page rules (size, margins, named pages)
  • Page headers and footers (@top-center, etc.)
  • Page counters (page, pages)
  • Page breaks (break-before, break-after)
  • Footnotes (float: footnote)

🖼️ Images & Fonts

  • PNG, JPEG, GIF, SVG (via CairoSVG)
  • TrueType, OpenType fonts
  • Font subsetting
  • Web fonts via @font-face
  • Font feature settings (kerning, ligatures)

⚠️ Limitations

WeasyPrint does not execute JavaScript — pages requiring client-side scripting won't render correctly. RTL/bidirectional text has limited support. For best results, use simple, semantic HTML with CSS designed for print.

📤 How to Use WeasyPrint

WeasyPrint can be used as a command-line tool or Python library:

Installation:

# Install via pip

pip install weasyprint

# Or with pipx (command-line only)

pipx install weasyprint

Command-Line Usage:

# Convert local file

weasyprint document.html document.pdf

# Convert URL

weasyprint https://example.com/page.html output.pdf

# Apply custom stylesheet

weasyprint document.html -s custom.css document.pdf

# Generate PDF/UA for accessibility

weasyprint document.html --pdf-variant=pdf/ua-1 accessible.pdf

Python API:

from weasyprint import HTML, CSS

 

# From HTML string

HTML(string='<h1>Hello</h1>').write_pdf('hello.pdf')

 

# From file

HTML('document.html').write_pdf('document.pdf')

 

# From URL

HTML('https://example.com').write_pdf('page.pdf')

 

# With custom stylesheet

HTML('doc.html').write_pdf('doc.pdf',

stylesheets=[CSS('custom.css')])

 

# Generate PDF/A-3b

HTML('doc.html').write_pdf('archive.pdf',

pdf_variant='pdf/a-3b')

🔍 Understanding PDF Metadata

WeasyPrint automatically extracts PDF metadata from HTML elements:

PDF Metadata HTML Source Description
Title <title> Document title
Author <meta name="author"> Document author(s) — can have multiple
Subject <meta name="description"> Document subject/description
Keywords <meta name="keywords"> Searchable keywords
Creator <meta name="generator"> Application that created HTML
Producer Automatic WeasyPrint [version]
Creation Date <meta name="dcterms.created"> ISO date format (e.g., 2024-12-31T12:34:56+02:00)
Modification Date <meta name="dcterms.modified"> ISO date format
Language <html lang="en"> Document language

HTML Example with Metadata:

<!DOCTYPE html>

<html lang="en">

<head>

<title>PDF Sample with Metadata</title>

<meta name="author" content="Jane Doe">

<meta name="author" content="John Doe">

<meta name="generator" content="My App v1.0">

<meta name="keywords" content="HTML, CSS, PDF">

<meta name="description" content="Sample document">

<meta name="dcterms.created" content="2024-12-31">

</head>

<body>...</body>

</html>

Sample Producer Values:

WeasyPrint Version Producer Value
WeasyPrint 68.0WeasyPrint 68.0 (https://weasyprint.org/)
WeasyPrint 62.3WeasyPrint 62.3 (https://weasyprint.org/)
WeasyPrint 60.1WeasyPrint 60.1 (https://weasyprint.org/)
WeasyPrint 54.0WeasyPrint 54.0 (https://weasyprint.org/)
WeasyPrint 52.5WeasyPrint 52.5 (https://weasyprint.org/)

🛠️ Troubleshooting

Common issues when using WeasyPrint:

Images Not Showing

Cause: Missing base_url or incorrect relative paths.

Solution: When using HTML(string=...), always provide base_url parameter: HTML(string=html, base_url='.'). For Flask/Django, use the framework-specific extensions (Flask-WeasyPrint, Django-WeasyPrint) which handle URL resolution automatically.

CSS Not Applied

Cause: External stylesheets not loading, or CSS features not supported.

Solution: Check if external CSS URLs are accessible. Use the stylesheets parameter to explicitly load CSS files. Remember WeasyPrint doesn't support CSS Grid or JavaScript — use Flexbox for layouts. Check the CSS support documentation for unsupported features.

Fonts Not Rendering Correctly

Cause: Font not installed on server, or @font-face path incorrect.

Solution: Install fonts system-wide (e.g., copy to /usr/local/share/fonts and run fc-cache). For web fonts, use absolute URLs or ensure base_url is set correctly. Consider using system fonts like Arial or DejaVu Sans for reliability.

Cairo/Pango Installation Issues

Cause: Missing system dependencies (Cairo, Pango, GDK-PixBuf).

Solution: On Ubuntu/Debian: apt install libcairo2 libpango-1.0-0 libgdk-pixbuf2.0-0. On macOS: brew install cairo pango gdk-pixbuf. On Windows, use prebuilt binaries from the WeasyPrint documentation or consider using Docker.

PDF/UA Validation Fails

Cause: Missing required HTML structure (title, lang attribute).

Solution: PDF/UA requires: a <title> tag, lang attribute on <html>, semantic HTML structure, and alt text on images. Use proper heading hierarchy and avoid inconsistencies in document structure.

❓ Frequently Asked Questions

When a PDF shows "WeasyPrint [version] (https://weasyprint.org/)" as the Producer, it means the PDF was generated using WeasyPrint, an open-source Python library that converts HTML and CSS to PDF. WeasyPrint is known for its excellent CSS Paged Media support and clean Python API.

Yes, WeasyPrint is completely free and open source, licensed under the BSD 3-clause license. You can use it in commercial projects without restrictions or fees. The project is maintained by CourtBouillon, which offers professional support and consulting services.

WeasyPrint was created in 2011 by Simon Sapin at Kozea, a French company. Since version 0.11, it passes the Acid2 test. The project is now professionally maintained by CourtBouillon, with version 68.0 released in January 2026.

No, WeasyPrint does not execute JavaScript. It's a CSS-focused rendering engine. Pages that rely on JavaScript for content generation or layout won't render correctly. If you need JavaScript support, consider browser-based solutions like Puppeteer or Playwright, though they lack WeasyPrint's CSS Paged Media capabilities.

WeasyPrint is free and open source, while Prince is commercial (expensive licenses). Prince has more features, better typography, and JavaScript support. WeasyPrint is lighter, easier to deploy, and excellent for many use cases. For simple to moderate documents, WeasyPrint is often sufficient; for complex publishing, Prince may be worth the investment.

WeasyPrint supports extensive PDF variants: PDF/A (1b, 2b, 3b, 2u, 3u, 4u, 1a, 2a, 3a, 4e, 4f) for archival, PDF/UA (1, 2) for accessibility, and PDF/X (1a, 3, 4, 5g) for print production. Use the --pdf-variant CLI option or pdf_variant Python parameter.

Yes, WeasyPrint supports Factur-X / ZUGFeRD electronic invoice generation. You need to provide RDF metadata and Factur-X XML as attachments. Use the Attachment class and set pdf_variant='pdf/a-3b' for compliant invoices. See the WeasyPrint documentation for detailed examples.

🛠️ Related Tools

Viewer

PDF Metadata Viewer

Free tool to view PDF metadata including Creator, Producer, and version information.

View PDF Metadata →
Converter

PDF Converter

Convert PDF files to Excel, Word, and other formats.

Convert PDF Files →

📝 Summary: WeasyPrint PDF Metadata

  • Original Author: Simon Sapin
  • Created by Kozea in 2011
  • Producer shows WeasyPrint [version]
  • License: BSD 3-clause (free)
  • Maintained by CourtBouillon
  • Current version: 68.0
  • Python 3.10+ required
  • CSS Paged Media excellent support
  • PDF/A, PDF/UA, PDF/X variants
  • No JavaScript execution