# pdfkit/pdfkit

A Ruby gem to transform HTML + CSS into PDFs using the command-line utility wkhtmltopdf

Repository: https://github.com/pdfkit/pdfkit
Canonical: https://ross.abutalabs.com/products/pdfkit-pdfkit
Language: Ruby
License: MIT
License Family: permissive
Topics: pdfkit, ruby, wkhtmltopdf, html-to-pdf, middleware
Last push: 2023-08-22T23:38:08+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 5948, "days_push": 1107, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2940, forks 418 (observed 2026-08-28T04:07:31.017474+00:00)

## What it is
PDFKit is a Ruby gem that converts HTML and CSS into PDF documents by wrapping the wkhtmltopdf command-line utility, which renders HTML via WebKit. It accepts HTML strings, files, or URLs, supports stylesheet injection and wkhtmltopdf options, and includes Rack middleware for on-the-fly PDF generation in Rails apps.

## Use cases
- generate pdf invoices from html templates in rails
- convert html reports to pdf in ruby
- render a webpage url as a pdf
- serve pdf versions of pages via rack middleware
- create pdfs with custom css stylesheets
- scrape a website and save it as a pdf with cookies

## When to choose
- you are building a Ruby or Rails app that needs HTML-to-PDF conversion
- you want simple API wrapping wkhtmltopdf with stylesheet and option support
- you need middleware to automatically serve .pdf URLs from your Rails app

## When to avoid
- you need a pure-Ruby solution without external binary dependencies
- wkhtmltopdf is deprecated in your environment and you want a maintained rendering engine like headless Chrome
- you need pixel-perfect modern CSS support beyond WebKit's rendering
- you are not working in Ruby

## Facets
- artifact type: library
- maturity: maintenance
- function: pdf, templating, middleware
- domain: pdf, web-development, backend, files
- platform: ruby, windows
- tags: wkhtmltopdf, html-to-pdf, ruby-gem, rails, report-generation, linux, macos, web-server

## Member repositories
- pdfkit/pdfkit (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:31.017474+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:32:57.442356+00:00, confidence not recorded.
  - readme: https://github.com/pdfkit/pdfkit (fetched 2026-08-28T04:07:31.017474+00:00, sha 85c5931a1dbd)
- Data as of 2026-08-30T08:39:29.467469+00:00.
