public static function run($r) { $_REQUEST['force_format'] = 'PNG'; // Force to PNG renderer $_REQUEST['svg_dom_gd_no_interlacing'] = true; // Otherwise FPDF will fail $tdir = pts_client::create_temporary_directory(); pts_client::generate_result_file_graphs($r[0], $tdir); $result_file = new pts_result_file($r[0]); $pdf = new pts_pdf_template($result_file->get_title(), null); $pdf->AddPage(); $pdf->Image(PTS_CORE_STATIC_PATH . 'images/pts-308x160.png', 69, 85, 73, 38); $pdf->Ln(120); $pdf->WriteStatementCenter('www.phoronix-test-suite.com'); $pdf->Ln(15); $pdf->WriteBigHeaderCenter($result_file->get_title()); $pdf->WriteText($result_file->get_description()); $pdf->AddPage(); $pdf->Ln(15); $identifiers = $result_file->get_system_identifiers(); $hardware_r = $result_file->get_system_hardware(); $software_r = $result_file->get_system_software(); $notes_r = $result_file->get_system_notes(); $tests = $result_file->get_test_titles(); $pdf->SetSubject($result_file->get_title() . ' Benchmarks'); $pdf->SetKeywords(implode(', ', $identifiers)); $pdf->WriteHeader('Test Systems:'); for ($i = 0; $i < count($identifiers); $i++) { $pdf->WriteMiniHeader($identifiers[$i]); $pdf->WriteText($hardware_r[$i]); $pdf->WriteText($software_r[$i]); //$pdf->WriteText($notes_r[$i]); } /* if(count($identifiers) > 1 && is_file($tdir . 'result-graphs/overview.jpg')) { $pdf->AddPage(); $pdf->Ln(100); $pdf->Image($tdir . 'result-graphs/overview.jpg', 15, 40, 180); } */ $pdf->AddPage(); $placement = 1; for ($i = 1; $i <= count($tests); $i++) { if (is_file($tdir . 'result-graphs/' . $i . '.png')) { $pdf->Ln(100); $pdf->Image($tdir . 'result-graphs/' . $i . '.png', 50, 40 + ($placement - 1) * 120, 120); } if ($placement == 2) { $placement = 0; if ($i != count($tests)) { $pdf->AddPage(); } } $placement++; } // To save: /* $pdf_file = 'SAVE_TO'; if(substr($pdf_file, -4) != '.pdf') { $pdf_file .= '.pdf'; } */ $pdf_file = pts_client::user_home_directory() . $r[0] . '.pdf'; $pdf->Output($pdf_file); pts_file_io::delete($tdir, null, true); echo PHP_EOL . 'Saved To: ' . $pdf_file . PHP_EOL; }