QR Code PDF component — renders a QR code at a given position.
Usage via Builder
%{type: :qr, props: %{
data: "https://example.com",
style: %{
position: {50, 700},
size: 120,
ec_level: :h,
logo: "https://example.com/icon.png",
logo_size: 30,
label: "Scan me"
}
}}Style options
Core
:data— the string to encode (required):size— QR code size in points, square (default100):ec_level— error correction::l,:m(default),:q,:h:color— module (dark) color (default{0, 0, 0}):background— light module color (default{1, 1, 1}):quiet_zone— number of quiet zone modules (default2)
Border & padding
:border— border width (default0):border_color— border stroke color (default{0.8, 0.8, 0.8}):border_radius— corner radius (default0):border_fill— fill color for border area / card background (defaultnil):padding— extra padding between border and QR (default0)
Logo / icon overlay (center of QR)
:logo— image path, URL, or{:binary, data}(defaultnil):logo_size— logo width & height in points (default 20% of:size):logo_background— background behind logo (default:background):logo_padding— padding around logo image (default3):logo_border_radius— rounded clip for logo area (default4)
Label
:label— text rendered below the QR code (defaultnil):label_font— font name (default"Helvetica"):label_font_size— font size (default8):label_color— text color (default same as:color):label_bold— bold label (defaultfalse)
Summary
Functions
Render a QR code onto the PDF document.