Example 11
Description
This example prints first a QR code into a rectangle with a width of 50mm and a height of 50mm. QR codes are squares, so the space will be filled with the QR code.
Then it prints a QR code into a rectangle with a width of 50mm and a height of 80mm. The code will be centered in the given rectangle. Above and below of the QR code there is some white space.
Next follows a QR code in a rectangle with a width of 100mm and a height of 40mm. The code will be centered in the given rectangle. Left and right of the QR code there is some white space.
And then a PDF417 code is printed into a rectangle with a width of 50mm and a height of 50mm. PDF417 codes are rectangles, because of that there is white space above and below the code.
Last it prints a DATAMATRIX code into a rectangle with a width of 50mm and a height of 50mm. DATAMATRIX codes are squares, so the space will be filled with the code image
Output
<?php include_once "../src/Report.php"; use Adi\ReportLib as ReportLib; // Create report instance // default format A4, portrait with margins left = 20mm, top = 10mm, right = 10mm and bottom = 10mm $report = new ReportLib\Report(); // Get ref to the report body $body = $report->getBody(); // QR code in a square $body->AddBarcode("reportlib.adiuvaris.ch", "QRCODE", 50.0, 50.0); $body->AddVDistance(5.0); // QR code in a rectangle height>width $body->AddBarcode("reportlib.adiuvaris.ch", "QRCODE", 50.0, 80.0); $body->AddVDistance(5.0); // QR code in a rectangle height>width $body->AddBarcode("reportlib.adiuvaris.ch", "QRCODE,H", 100.0, 40.0); $body->AddVDistance(5.0); // PDF417 code in a square $body->AddBarcode("reportlib.adiuvaris.ch", "PDF417", 50.0, 50.0); $body->AddVDistance(5.0); // Datamatrix code in a square $body->AddBarcode("reportlib.adiuvaris.ch", "DATAMATRIX", 50.0, 50.0); $body->AddVDistance(5.0); // Produce the output of the report // uses the same params as TCPDF (F = File, I = Preview etc.) $report->output(__DIR__ . "/example_011.pdf", 'I');