wkhtmltopdf PDF Creator & Producer

Understanding PDF metadata that shows wkhtmltopdf as the Creator and Producer — learn how this open-source command-line tool converts HTML documents and web pages into PDF files.

🔧 Command Line Tool 📄 HTML to PDF 🆓 Open Source

📄 About This PDF Metadata

When you examine a PDF file's properties and see wkhtmltopdf listed as the Creator and Qt as the Producer, it indicates that the document was generated using the wkhtmltopdf command-line tool.

Sample PDF Metadata from wkhtmltopdf:

Creator: wkhtmltopdf 0.12.6

Producer: Qt 4.8.7

Creation Date: 2025-01-27 10:30:45

PDF Version: 1.4

This metadata is automatically embedded when you convert HTML files or web pages to PDF using wkhtmltopdf. The Creator field shows the wkhtmltopdf version, while the Producer field shows the Qt library version used for rendering.

PDF Creator

Shows wkhtmltopdf followed by version number (e.g., 0.12.6). Indicates the command-line tool that initiated the PDF conversion.

PDF Producer

Shows Qt followed by version (e.g., Qt 4.8.7). This is the underlying framework that handles the actual PDF generation.

🔧 What is wkhtmltopdf?

wkhtmltopdf is an open-source command-line tool that converts HTML documents and web pages into PDF format. Created by Jakob Truelsen in 2008, it uses the Qt WebKit rendering engine to produce high-quality, pixel-perfect PDF output. The tool runs entirely "headless" without requiring a display or browser window.

Project Information

Developer:Jakob Truelsen (original)
Maintainer:Ashish Kulkarni
Created:2008
License:LGPLv3 (Open Source)
Website:wkhtmltopdf.org

Technical Details

Current Version:0.12.6
Language:C++
Engine:Qt WebKit
Platforms:Windows, Linux, macOS
GitHub Stars:14,500+

⚠️ Project Status

The wkhtmltopdf repository was archived on January 2, 2023. While the tool is still widely used and available for download, it is no longer actively maintained. The underlying Qt WebKit engine hasn't been updated since 2012.

Key Features of wkhtmltopdf:

🌐

HTML to PDF

Convert web pages and local HTML files to PDF documents

🎨

CSS Support

Full CSS support including media queries and print styles

JavaScript

Execute JavaScript before PDF generation

📑

Headers/Footers

Built-in support for page headers and footers

📋

Table of Contents

Automatic TOC generation from HTML headings

🖥️

Headless

Runs without display, perfect for servers

⚙️ How wkhtmltopdf Creates PDFs

wkhtmltopdf uses the Qt WebKit rendering engine (the same engine used in early versions of Safari and Chrome) to render HTML content and convert it to PDF format. The process happens entirely on the command line without needing a graphical browser.

PDF Generation Process:

  1. User runs wkhtmltopdf command with input URL/file
  2. Qt WebKit engine loads and renders the HTML
  3. CSS stylesheets are applied (including print media)
  1. JavaScript is executed if enabled
  2. Content is paginated according to page settings
  3. PDF file is generated with embedded metadata

The tool supports both local HTML files and remote URLs. It can handle complex layouts, images, fonts, and even JavaScript-rendered content, making it popular for generating reports, invoices, and documentation from web templates.

💡 Did You Know?

wkhtmltopdf was created just one day after Qt 4.4 introduced QtWebKit. It was ahead of its time — Chrome didn't add equivalent PDF printing support until Chrome 64 in 2017, more than 8 years later!

📤 How to Use wkhtmltopdf

wkhtmltopdf is a command-line tool. After installing it on your system, you can convert HTML to PDF with simple commands:

Basic Usage Examples:

# Convert a local HTML file to PDF

wkhtmltopdf input.html output.pdf

# Convert a web page to PDF

wkhtmltopdf https://example.com page.pdf

# Convert with custom page size

wkhtmltopdf --page-size A4 input.html output.pdf

Installation Methods:

Platform Installation Command / Method
Ubuntu/Debiansudo apt-get install wkhtmltopdf
CentOS/RHELsudo yum install wkhtmltopdf
macOSbrew install --cask wkhtmltopdf
WindowsDownload installer from wkhtmltopdf.org
DockerUse official Docker images with wkhtmltopdf

Advanced Example with Headers and Footers:

wkhtmltopdf \
  --page-size A4 \
  --margin-top 20mm \
  --margin-bottom 20mm \
  --header-center "Document Title" \
  --footer-center "Page [page] of [topage]" \
  --footer-font-size 9 \
  input.html output.pdf

🔧 Command Options

wkhtmltopdf provides extensive command-line options to customize PDF output:

Page Options

  • --page-size : A4, Letter, Legal, etc.
  • --orientation : Portrait or Landscape
  • --margin-* : Top, bottom, left, right margins
  • --dpi : Output resolution (default: 96)

Header/Footer Options

  • --header-center : Header text (center)
  • --footer-center : Footer text (center)
  • --header-html : Custom header HTML file
  • --footer-html : Custom footer HTML file

Content Options

  • --javascript-delay : Wait for JS (ms)
  • --no-javascript : Disable JavaScript
  • --enable-local-file-access : Allow local files
  • --encoding : Character encoding (UTF-8)

Output Options

  • --grayscale : Generate grayscale PDF
  • --lowquality : Lower quality, smaller file
  • --title : Set PDF title metadata
  • --outline : Generate PDF outline/TOC

Common Command-Line Options Reference:

Option Description Example
--page-sizeSet paper size--page-size A4
--orientationPage orientation--orientation Landscape
--margin-topTop margin--margin-top 15mm
--footer-centerCentered footer text--footer-center "Page [page]"
--javascript-delayJS execution delay--javascript-delay 1000
--zoomZoom factor--zoom 1.5

📑 Common Uses

wkhtmltopdf is widely used in various industries and applications:

Businesses use wkhtmltopdf to automatically generate PDF invoices, receipts, and reports from HTML templates. This enables dynamic content generation with consistent formatting.

Common Integration: Web applications (PHP, Python, Ruby, Node.js), ERP systems, e-commerce platforms

Convert HTML documentation, user guides, and technical manuals into PDF format for offline distribution or printing.

Common Integration: Documentation generators, wiki systems, help desk software

Save web pages as PDF for archival purposes, legal records, or offline reading while preserving the original layout and styling.

Common Integration: Archiving tools, compliance systems, research applications

Generate personalized certificates, diplomas, and awards from HTML templates with dynamic data insertion.

Common Integration: Learning management systems (LMS), event platforms, HR systems

Export tabular data, charts, and dashboards from web applications as formatted PDF reports.

Common Integration: Analytics platforms, CRM systems, business intelligence tools

🔍 Understanding PDF Metadata

PDFs created by wkhtmltopdf contain standard metadata fields. You can customize some of these using command-line options:

Metadata Field Typical Value Customizable?
Creator wkhtmltopdf 0.12.6 No (hardcoded)
Producer Qt 4.8.7 No (hardcoded)
Title From HTML <title> or --title Yes (--title "Your Title")
Creation Date Current timestamp No
Page Size 595 x 842 pts (A4) Yes (--page-size)
PDF Version 1.4 No

View PDF Metadata (Linux/macOS):

# Using pdfinfo (poppler-utils)

pdfinfo output.pdf

# Example output:

Title: My Document

Creator: wkhtmltopdf 0.12.6

Producer: Qt 4.8.7

CreationDate: Mon Jan 27 10:30:45 2025

Pages: 5

💡 Changing Creator/Producer

The Creator and Producer fields are hardcoded in wkhtmltopdf. To change them, you need to post-process the PDF using tools like pdftk, exiftool, or PDF libraries in your programming language.

🛠️ Troubleshooting

Common issues and solutions when using wkhtmltopdf:

Blank or Empty PDF Output

Cause: JavaScript content not fully loaded, or local file access is blocked.

Solution: Add --javascript-delay 1000 to wait for JS to execute, or --enable-local-file-access for local files.

Images Not Appearing

Cause: Images using relative paths or external URLs that can't be accessed.

Solution: Use absolute paths for images, or ensure network access. Add --enable-local-file-access for local images.

CSS Styles Not Applied

Cause: CSS files not accessible, or using @media screen instead of @media print.

Solution: Use --print-media-type option (requires patched Qt), or ensure CSS uses @media print rules.

Fonts Look Wrong or Missing

Cause: Custom web fonts not loaded, or system fonts not available.

Solution: Install required fonts on the system, or embed fonts in CSS using base64. Add --javascript-delay for web font loading.

Security Warning: QXcbConnection Error

Cause: Running on a server without display (common in headless environments).

Solution: Install xvfb and run with: xvfb-run wkhtmltopdf input.html output.pdf

❓ Frequently Asked Questions

When a PDF shows "wkhtmltopdf" as the Creator in its metadata, it means the document was generated using the wkhtmltopdf command-line tool. This indicates the PDF was converted from an HTML document or web page using the Qt WebKit rendering engine.

Yes, wkhtmltopdf is completely free and open-source software licensed under LGPLv3. You can use it for personal, commercial, and enterprise applications without any licensing fees.

The wkhtmltopdf repository was archived on January 2, 2023. While the tool still works and is widely used, it is no longer actively developed. For new projects, consider alternatives like WeasyPrint, Puppeteer, or Prince.

wkhtmltopdf converts HTML to PDF documents, while wkhtmltoimage converts HTML to image formats (PNG, JPG, etc.). Both tools come in the same package and use the same Qt WebKit rendering engine.

Yes, wkhtmltopdf can be integrated into web applications written in PHP, Python, Ruby, Node.js, Java, and other languages. Most frameworks have wrapper libraries available. However, be cautious about security when processing untrusted HTML.

The "patched Qt" version includes modifications to the Qt WebKit library that enable additional features like --print-media-type support. The unpatched version (from package managers) has limited functionality. Download the patched version from the official website for full features.

Warning: Never use wkhtmltopdf with untrusted HTML content. The underlying WebKit engine has known security vulnerabilities. Always sanitize user-supplied HTML/JS, and consider using AppArmor, SELinux, or containerization for additional security.

🛠️ Related Tools

Viewer

PDF Metadata Viewer

Free tool to view PDF metadata including Creator, Producer, and creation dates.

View PDF Metadata →
Converter

PDF Converter

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

Convert PDF Files →

📝 Summary: wkhtmltopdf PDF Metadata

  • wkhtmltopdf is an HTML to PDF converter
  • Creator shows wkhtmltopdf + version
  • Producer shows Qt + version
  • Uses Qt WebKit rendering engine
  • Command-line tool, no GUI required
  • Created by Jakob Truelsen in 2008
  • Open source (LGPLv3 license)
  • Works on Windows, Linux, macOS
  • Repository archived January 2023
  • Alternatives: WeasyPrint, Puppeteer, Prince