Rendering dynamic PDFs so fast you'll (fr)eek.
Marmot is a PostScript-inspired template renderer for generating small dynamic PDFs and images from structured data.
The initial goal is to render label-sized PDFs from Marmot templates and JSON/JSONL data, with a focus on deterministic batch rendering.
- CLI usage:
docs/cli.md - PSL language reference:
docs/psl.md - Docs index:
docs/index.md
Note: the example below includes ideas that are not fully implemented yet. For implementation-accurate syntax and operators, use
docs/psl.md.
%!PSL 0.1
page 612 792
slots begin
product_name string required
base_price string required
sale_price string required
buy int required
get int required
end
fonts begin
helvetica "fonts/Helvetica.ttf"
helvetica_bold "fonts/Helvetica-Bold.ttf"
end
assets begin
logo image "assets/logo.png"
badge image "assets/logo.png"
end
draw begin
% Background and border
1 1 1 rgb
0 0 612 792 rect fill
1 0 0 rgb
72 72 468 648 rect stroke
% Embedded image
logo 420 40 120 60 image contain
% Product name
$(helvetica_bold) font
28 fontsize
center align
middle valign
0 0 0 1 cmyk
$(product_name) 72 100 468 80 textbox
% Offer
helvetica font
64 fontsize
(BUY ) $(buy) ( GET ) $(get) 4 concat 72 240 468 100 textbox % output: "BUY 2 GET 1"
% Price
helvetica_bold font
96 fontsize
0.5 grey
$(sale_price) 72 380 468 130 textbox
end
