PDF::AP...::qrcode(3)
β¨ NAME β¨
PDF::API2::Resource::XObject::Form::BarCode::qrcode β bestie, it makes QR codes π (and yeah, the manual page for this one is filed under PDF::AP...::qrcode(3), iykyk)
π SYNOPSIS π
okay so this is the whole vibe, copy-paste and go:
use PDF::API2;
my $pdf = PDF::API2->new();
my $page = $pdf->page();
# Create a QR Code object
my $barcode = $pdf->barcode('qr', 'This is a test');
# Calculate the scale needed for a desired size (72pt / inch)
my $desired_inches = 2;
my $scale = $desired_inches * 72 / $barcode->width();
# Place the QR Code one inch (72pt) from the bottom left corner
$page->object($barcode, 72, 72, $scale);
$pdf->save('qr_test.pdf');
π¦ REQUIREMENTS π¦
Text::QRCode is the one doing the actual encoding, no cap. It's giving essential dependency π
π OPTIONS π
the whole call looks like this:
my $barcode = $pdf->barcode('qr', $value, %options);
πΈ The standard barcode options
these are supported exactly like they're described in "barcode" in PDF::API2:
bar_widthβ default:1; the unit is points β¨bar_heightβ default: the bar widthquiet_zoneβ default: 4x the bar widthcolorβ default: black π€
π The QR-specific options
these ones are special to QR codes, main character energy only:
error_correctionβ default:L
The QR Code Error Correction Level. Higher levels of error correction generate larger bar codes, but the slay part is they stay scannable even when parts of the code are damaged or obscured π iconic.
In increasing order of error correction, the possible values are:
L(7%)M(15%)Q(25%)H(30%)
versionβ default:0
If you need a specific version of QR Code, enter it here, bestie. Otherwise, the minimum version will be used that can support the encoded value π«Ά
modeβ default:8-bit
You can generate smaller QR codes if you're using a restricted character set:
8-bit(typically the ISO-8859-1 character set)kanjialphanumeric(digits, uppercase letters, space, or"$ % * + - . / :")numeric(digits)
case_sensitiveβ default:1
Whether 8-bit characters should be treated in a case-sensitive manner.
real talk: those error-correction levels are a tradeoff, not a flex.H(30%) survives more damage but gives you a chunkier code, andL(7%) stays smol. pick your fighter π
and that's the whole page, babe β¨ this was perl v5.42.0, dated 2025-09-01 β go forth and generate cute little squares πππ¦
π¦ where this page comes from
- fedora 43: perl-PDF-API2 2.048-1.fc43 Β· LGPL-2.1-or-later AND (GPL-1.0-or-later OR Artistic-1.0-Perl) AND (MIT OR Artistic-1.0-Perl)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms