PDF::API2::Resource::XObject::Form::BarCode::qrcode(3pm) | User Contributed Perl Documentation | PDF::API2::Resource::XObject::Form::BarCode::qrcode(3pm) |
PDF::API2::Resource::XObject::Form::BarCode::qrcode - Generate QR codes
use PDF::API2; my $pdf = PDF::API2->new(); my $page = $pdf->page(); # Create a QR Code object my $barcode = $pdf->barcode('qr', code => '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');
Text::QRCode is used to encode QR codes.
my $barcode = $pdf->barcode('qr', $value, %options);
The following standard barcode options are supported, as described in "barcode" in PDF::API2:
The following options are specific to QR codes:
The QR Code Error Correction Level. Higher levels of error correction generate larger bar codes but remain scannable when parts of the code are damaged or obscured.
In increasing order of error correction, the possible values are:
If you need a specific version of QR Code, enter it here. Otherwise, the minimum version will be used that can support the encoded value.
You can generate smaller QR codes if you're using a restricted character set:
Whether 8-bit characters should be treated in a case-sensitive manner.
2022-12-23 | perl v5.36.0 |