LuaRocks.org had a security incident in September 2026. Read the incident report.

lua-pdfkit

Pure Lua PDF writer, a port of PDFKit 0.20.2

$ luarocks install lua-pdfkit

Pure Lua PDF writer. No Node, no C module, and no network at runtime.
require "pdfkit" returns the document constructor.

This is an independent port of PDFKit 0.20.2 by Devon Govett
(https://pdfkit.org/, https://github.com/foliojs/pdfkit). The rock
version does not track PDFKit's version. This project is not
affiliated with foliojs.

local PDFDocument = require "pdfkit"

local doc = PDFDocument.new({ size = "LETTER" })
doc:fontSize(16)
doc:text("hello", 72, 72)

local out = assert(io.open("out.pdf", "wb"))
doc:pipe(out)
doc:finish()
out:close()

pipe takes an open Lua file handle and is optional.
doc:output() returns the PDF as a string after finish().
doc:finish() is PDFKit's doc.end(), and ref:finish() is ref.end(),
because Lua reserves end. Other names keep PDFKit's spelling.
PDFKit's guide: https://pdfkit.org/docs/getting_started.html

The twenty-two compared families match PDFKit 0.20.2 byte for byte
after blanking PDF dates, the trailer /ID, and xmp:CreateDate. That
includes forms, outlines, Hebrew, Arabic, embedded CFF (.otf), and
WOFF1. Standard fonts are WinAnsi; Unicode text needs an embedded
font. Passwords are refused. WOFF2 is not supported. This is a
writer: it does not read, merge, or stamp an existing PDF.

If a PDFKit feature you need did not make 1.0.0, please ask for it:
https://github.com/500Foods/lua-pdfkit/issues

Needs Lua 5.5 or newer. The rock builds no C.

Source and issues:
https://github.com/500Foods/lua-pdfkit
https://github.com/500Foods/lua-pdfkit/issues

Versions

1.0.1-18 hours ago0 downloads
1.0.0-19 hours ago(revision: 2)3 downloads

Dependencies

lua >= 5.5

Manifests