Example 10
Description
The example prints an image into a rectangle with a width of 100mm and a height of 100mm, but keep the aspect ratio of the picture – therefore the frame height will be adjusted. The original size is 1920×1208 pixels.
Next it prints an image into a rectangle with a width of 100mm and a height of 30mm, but keep the aspect ratio of the picture – therefore the frame width will be adjusted.
Last it prints an image into a rectangle with a width of 20mm and a height of 40mm, it does not keep the aspect ratio of the picture.
Output
<?php nclude_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(); $body->AddImage("image.jpg", true, 100.0, 100.0); $body->AddVDistance(5.0); $body->AddImage("image.jpg", true, 100.0, 30.0); $body->AddVDistance(5.0); $body->AddImage("image.jpg", false, 20.0, 40.0); // Produce the output of the report // uses the same params as TCPDF (F = File, I = Preview etc.) $report->output(__DIR__ . "/example_010.pdf", 'I');