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 width
  • quiet_zone β€” default: 4x the bar width
  • color β€” 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)
  • kanji
  • alphanumeric (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, and L (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