How to use pts_pdf_template class

Best Phoronix-test-suite code snippet using pts_pdf_template

dump_documentation.php

Source:dump_documentation.php Github

copy

Full Screen

...18class dump_documentation implements pts_option_interface19{20 public static function run($r)21 {22 $pdf = new pts_pdf_template(pts_core::program_title(false), 'Test Client Documentation');23 $html_doc = new pts_html_template(pts_core::program_title(false), 'Test Client Documentation');24 $pdf->AddPage();25 $pdf->Image(PTS_CORE_STATIC_PATH . 'images/pts-308x160.png', 69, 85, 73, 38, 'PNG', 'http://www.phoronix-test-suite.com/');26 $pdf->Ln(120);27 $pdf->WriteStatement('www.phoronix-test-suite.com', 'C', 'http://www.phoronix-test-suite.com/');28 $pdf->Ln(15);29 $pdf->WriteBigHeaderCenter(pts_core::program_title(true));30 $pdf->WriteHeaderCenter('User Manual');31 //$pdf->WriteText($result_file->get_description());32 $pts_options = pts_documentation::client_commands_array();33 // Write the test options HTML34 $dom = new DOMDocument();35 $html = $dom->createElement('html');36 $dom->appendChild($html);37 $head = $dom->createElement('head');38 $title = $dom->createElement('title', 'User Options');39 $head->appendChild($title);40 $html->appendChild($head);41 $body = $dom->createElement('body');42 $html->appendChild($body);43 $p = $dom->createElement('p', 'The following options are currently supported by the Phoronix Test Suite client. A list of available options can also be found by running ');44 $em = $dom->createElement('em', 'phoronix-test-suite help.');45 $p->appendChild($em);46 $phr = $dom->createElement('hr');47 $p->appendChild($phr);48 $body->appendChild($p);49 foreach($pts_options as $section => &$contents)50 {51 if(empty($contents))52 {53 continue;54 }55 $header = $dom->createElement('h1', $section);56 $body->appendChild($header);57 sort($contents);58 foreach($contents as &$option)59 {60 $sub_header = $dom->createElement('h3', $option[0]);61 $em = $dom->CreateElement('em', ' ' . implode(' ', $option[1]));62 $sub_header->appendChild($em);63 $body->appendChild($sub_header);64 $p = $dom->createElement('p', $option[2]);65 $body->appendChild($p);66 }67 }68 $dom->saveHTMLFile(PTS_PATH . 'documentation/stubs/00_user_options.html');69 // Write the module options HTML70 $dom = new DOMDocument();71 $html = $dom->createElement('html');72 $dom->appendChild($html);73 $head = $dom->createElement('head');74 $title = $dom->createElement('title', 'Module Options');75 $head->appendChild($title);76 $html->appendChild($head);77 $body = $dom->createElement('body');78 $html->appendChild($body);79 $p = $dom->createElement('p', 'The following list is the modules included with the Phoronix Test Suite that are intended to extend the functionality of pts-core. Some of these options have commands that can be run directly in a similiar manner to the other Phoronix Test Suite user commands. Some modules are just meant to be loaded directly by adding the module name to the LoadModules tag in ~/.phoronix-test-suite/user-config.xml or via the PTS_MODULES environmental variable. A list of available modules is also available by running ');80 $em = $dom->createElement('em', 'phoronix-test-suite list-modules.');81 $p->appendChild($em);82 $phr = $dom->createElement('hr');83 $p->appendChild($phr);84 $body->appendChild($p);85 foreach(pts_module_manager::available_modules(true) as $module)86 {87 pts_module_manager::load_module($module);88 $header = $dom->createElement('h2', pts_module_manager::module_call($module, 'module_name'));89 $body->appendChild($header);90 $desc = $dom->createElement('p', pts_module_manager::module_call($module, 'module_description'));91 $body->appendChild($desc);92 $all_options = pts_module_manager::module_call($module, 'user_commands');93 if(count($all_options) > 0)94 {95 // $sub_header = $dom->createElement('h3', 'Module Commands');96 // $body->appendChild($sub_header);97 foreach($all_options as $key => $option)98 {99 $p = $dom->createElement('p', 'phoronix-test-suite ' . $module . '.' . str_replace('_', '-', $key));100 $body->appendChild($p);101 }102 }103 $vars = pts_module_manager::module_call($module, 'module_environmental_variables');104 if(is_array($vars) && count($vars) > 0)105 {106 $p = $dom->createElement('p', 'This module utilizes the following environmental variables: ' . implode(', ', $vars) . '.');107 $body->appendChild($p);108 }109 }110 $dom->saveHTMLFile(PTS_PATH . 'documentation/stubs/00_zmodule_options.html');111 // Write the external dependencies HTML112 $dom = new DOMDocument();113 $html = $dom->createElement('html');114 $dom->appendChild($html);115 $head = $dom->createElement('head');116 $title = $dom->createElement('title', 'External Dependencies');117 $head->appendChild($title);118 $html->appendChild($head);119 $body = $dom->createElement('body');120 $html->appendChild($body);121 $p = $dom->createElement('p', 'The Phoronix Test Suite has a feature known as "External Dependencies" where the Phoronix Test Suite can attempt to automatically install some of the test-specific dependencies on supported distributions. If running on a distribution where there is currently no External Dependencies profile, the needed package name(s) are listed for manual installation.');122 $body->appendChild($p);123 $p = $dom->createElement('p', 'Below are a list of the operating systems that currently have external dependencies support within the Phoronix Test Suite for the automatic installation of needed test files.');124 $body->appendChild($p);125 $phr = $dom->createElement('hr');126 $p->appendChild($phr);127 $exdep_generic_parser = new pts_exdep_generic_parser();128 $vendors = array_merge($exdep_generic_parser->get_vendor_aliases_formatted(), $exdep_generic_parser->get_vendors_list_formatted());129 sort($vendors);130 $ul = $dom->createElement('ul');131 $p->appendChild($ul);132 foreach($vendors as $vendor)133 {134 $li = $dom->createElement('li', $vendor);135 $p->appendChild($li);136 }137 $dom->saveHTMLFile(PTS_PATH . 'documentation/stubs/02_external_dependencies.html');138 // Write the virtual suites HTML139 $dom = new DOMDocument();140 $html = $dom->createElement('html');141 $dom->appendChild($html);142 $head = $dom->createElement('head');143 $title = $dom->createElement('title', 'Virtual Test Suites');144 $head->appendChild($title);145 $html->appendChild($head);146 $body = $dom->createElement('body');147 $html->appendChild($body);148 $p = $dom->createElement('p', 'Virtual test suites are not like a traditional test suite defined by the XML suite specification. Virtual test suites are dynamically generated in real-time by the Phoronix Test Suite client based upon the specified test critera. Virtual test suites can automatically consist of all test profiles that are compatible with a particular operating system or test profiles that meet other critera. When running a virtual suite, the OpenBenchmarking.org repository of the test profiles to use for generating the dynamic suite must be prefixed. ');149 $body->appendChild($p);150 $p = $dom->createElement('p', 'Virtual test suites can be installed and run just like a normal XML test suite and shares nearly all of the same capabilities. However, when running a virtual suite, the user will be prompted to input any user-configuration options for needed test profiles just as they would need to do if running the test individually. When running a virtual suite, the user also has the ability to select individual tests within the suite to run or to run all of the contained test profiles. Virtual test suites are also only supported for an OpenBenchmarking.org repository if there is no test profile or test suite of the same name in the repository. Below is a list of common virtual test suites for the main Phoronix Test Suite repository, but the dynamic list of available virtual test suites based upon the enabled repositories is available by running ');151 $em = $dom->createElement('em', 'phoronix-test-suite list-available-virtual-suites.');152 $p->appendChild($em);153 $phr = $dom->createElement('hr');154 $p->appendChild($phr);155 $body->appendChild($p);156 foreach(pts_virtual_test_suite::available_virtual_suites() as $virtual_suite)157 {158 $sub_header = $dom->createElement('h3', $virtual_suite->get_title());159 $em = $dom->CreateElement('em', ' ' . $virtual_suite->get_identifier());160 $sub_header->appendChild($em);161 $body->appendChild($sub_header);162 $p = $dom->createElement('p', $virtual_suite->get_description());163 $body->appendChild($p);164 }165 $dom->saveHTMLFile(PTS_PATH . 'documentation/stubs/55_virtual_suites.html');166 // Load the HTML documentation167 foreach(pts_file_io::glob(PTS_PATH . 'documentation/stubs/*_*.html') as $html_file)168 {169 $pdf->html_to_pdf($html_file);170 $html_doc->html_to_html($html_file);171 }172 if(!is_writable(PTS_PATH . 'documentation/'))173 {174 echo PHP_EOL . 'Not writable: ' . PTS_PATH . 'documentation/';175 }176 else177 {178 $pdf_file = PTS_PATH . 'documentation/phoronix-test-suite.pdf';179 $pdf->Output($pdf_file);180 $html_doc->Output(PTS_PATH . 'documentation/phoronix-test-suite.html');181 echo PHP_EOL . 'Saved To: ' . $pdf_file . PHP_EOL . PHP_EOL;182 // Also re-generate the man page183 $man_page = '.TH phoronix-test-suite 1 "www.phoronix-test-suite.com" "' . PTS_VERSION . '"' . PHP_EOL . '.SH NAME' . PHP_EOL;184 $man_page .= 'phoronix-test-suite \- The Phoronix Test Suite is an extensible open-source platform for performing testing and performance evaluation.' . PHP_EOL;185 $man_page .= '.SH SYNOPSIS' . PHP_EOL . '.B phoronix-test-suite [options]' . PHP_EOL . '.br' . PHP_EOL . '.B phoronix-test-suite benchmark [test | suite]' . PHP_EOL;186 $man_page .= '.SH DESCRIPTION' . PHP_EOL . pts_documentation::basic_description() . PHP_EOL;187 $man_page .= '.SH OPTIONS' . PHP_EOL . '.TP' . PHP_EOL;188 foreach($pts_options as $section => &$contents)189 {190 if(empty($contents))191 {192 continue;193 }194 $man_page .= '.SH ' . strtoupper($section) . PHP_EOL;195 sort($contents);196 foreach($contents as &$option)197 {198 $man_page .= '.B ' . trim($option[0] . ' ' . (!empty($option[1]) && is_array($option[1]) ? implode(' ', $option[1]) : null)) . PHP_EOL . $option[2] . PHP_EOL . '.TP' . PHP_EOL;199 }200 }201 $man_page .= '.SH SEE ALSO' . PHP_EOL . '.B Websites:' . PHP_EOL . '.br' . PHP_EOL . 'http://www.phoronix-test-suite.com/' . PHP_EOL . '.br' . PHP_EOL . 'http://commercial.phoronix-test-suite.com/' . PHP_EOL . '.br' . PHP_EOL . 'http://www.openbenchmarking.org/' . PHP_EOL . '.br' . PHP_EOL . 'http://www.phoronix.com/' . PHP_EOL . '.br' . PHP_EOL . 'http://www.phoronix.com/forums/' . PHP_EOL;202 $man_page .= '.SH AUTHORS' . PHP_EOL . 'Copyright 2008 - ' . date('Y') . ' by Phoronix Media, Michael Larabel.' . PHP_EOL . '.TP' . PHP_EOL;203 file_put_contents(PTS_PATH . 'documentation/man-pages/phoronix-test-suite.1', $man_page);204 }205 // simple README206 $readme = '# Phoronix Test Suite ' . PTS_VERSION . PHP_EOL . 'http://www.phoronix-test-suite.com/' . PHP_EOL . PHP_EOL;207 $readme .= pts_documentation::basic_description() . PHP_EOL . PHP_EOL;208 $readme .= pts_file_io::file_get_contents(PTS_PATH . 'documentation/stubs/readme-basics.txt') . PHP_EOL . PHP_EOL;209 $readme = wordwrap($readme, 80, PHP_EOL);210 file_put_contents(PTS_PATH . 'README.md', $readme);211 // Phoromatic Documentation212 $pdf = new pts_pdf_template(pts_core::program_title(false), 'Phoromatic Documentation');213 $html_doc = new pts_html_template(pts_core::program_title(false), 'Phoromatic Documentation');214 $pdf->AddPage();215 $pdf->Image(PTS_CORE_STATIC_PATH . 'images/pts-308x160.png', 69, 85, 73, 38, 'PNG', 'http://www.phoronix-test-suite.com/');216 $pdf->Ln(120);217 $pdf->WriteStatement('www.phoronix-test-suite.com', 'C', 'http://www.phoronix-test-suite.com/');218 $pdf->Ln(15);219 $pdf->Image(PTS_CORE_STATIC_PATH . 'images/phoromatic-390x56.png', 55, 250, 0, 0, 'PNG', 'http://www.phoronix-test-suite.com/');220 //$pdf->Image(PTS_CORE_STATIC_PATH . 'images/phoromatic-390x56.png', 69, 85, 73, 38, 'PNG', 'http://www.phoromatic.com/');221 $pdf->WriteBigHeaderCenter(pts_core::program_title(true));222 $pdf->WriteHeaderCenter('Phoromatic User Manual');223 $pdf->html_to_pdf(PTS_PATH . 'documentation/phoromatic.html');224 $pdf_file = PTS_PATH . 'documentation/phoromatic.pdf';225 $pdf->Output($pdf_file);226 echo PHP_EOL . 'Saved To: ' . $pdf_file . PHP_EOL . PHP_EOL;...

Full Screen

Full Screen

pts_pdf_template

Using AI Code Generation

copy

Full Screen

1require_once('pts_pdf_template.php');2$pdf = new pts_pdf_template();3$pdf->set_file_name('test.pdf');4$pdf->set_title('Test');5$pdf->set_author('Tester');6$pdf->set_subject('Test');7$pdf->set_keywords('Test');8$pdf->set_creator('Tester');9$pdf->set_header('Test');10$pdf->set_footer('Test');11$pdf->set_content('Test');12$pdf->create_pdf();13$pdf->download_pdf();14require_once('pts_pdf_template.php');15$pdf = new pts_pdf_template();16$pdf->set_file_name('

Full Screen

Full Screen

pts_pdf_template

Using AI Code Generation

copy

Full Screen

1require_once('pts-pdf-template.php');2$pts_pdf = new pts_pdf_template();3$pts_pdf->set_font('Helvetica', '', 10);4$pts_pdf->set_margins(10, 10, 10);5$pts_pdf->set_title('Sample PDF file');6$pts_pdf->set_author('Phoronix Test Suite');7$pts_pdf->add_page();8$pts_pdf->set_font('Helvetica', '', 10);9$pts_pdf->set_text_color(0, 0, 0);10$pts_pdf->write(5, 'This is a sample PDF file generated using Phoronix Test Suite.');11$pts_pdf->output('sample.pdf', 'F');12require_once('tcpdf/tcpdf.php');13$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);14$pdf->SetCreator(PDF_CREATOR);15$pdf->SetAuthor('Phoronix Test Suite');16$pdf->SetTitle('Sample PDF file');17$pdf->SetSubject('Sample PDF file');18$pdf->SetKeywords('TCPDF, PDF, Phoronix Test Suite');19$pdf->setPrintHeader(false);20$pdf->setPrintFooter(false);21$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);22$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);23$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);24$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);25$pdf->setFontSubsetting(true);26$pdf->SetFont('helvetica', '', 11, '', true);27$pdf->AddPage();28$pdf->writeHTML($html, true, false, true, false, '');29$pdf->Output('sample.pdf', 'F');

Full Screen

Full Screen

pts_pdf_template

Using AI Code Generation

copy

Full Screen

1require_once('pts_pdf_template.php');2$pdf = new pts_pdf_template('P','mm','A4');3$pdf->SetTitle('Phoronix Test Suite');4$pdf->SetAuthor('Phoronix Test Suite');5$pdf->SetSubject('Phoronix Test Suite');6$pdf->SetKeywords('Phoronix Test Suite');7$pdf->SetMargins(10, 10, 10);8$pdf->SetAutoPageBreak(TRUE, 10);9$pdf->setImageScale(1.25);10$pdf->SetFont('helvetica', '', 10);11$pdf->AddPage();12$pdf->SetTextColor(0, 0, 0);13$pdf->SetFont('helvetica', '', 10);14$pdf->SetTextColor(0, 0, 0);15$pdf->SetFont('helvetica', '', 10);16$pdf->SetTextColor(0, 0, 0);17$pdf->SetFont('helvetica', '', 10);18$pdf->SetTextColor(0, 0, 0);19$pdf->SetFont('helvetica', '', 10);20$pdf->SetTextColor(0, 0, 0);21$pdf->SetFont('helvetica', '', 10);22$pdf->SetTextColor(0, 0, 0);23$pdf->SetFont('helvetica', '', 10);24$pdf->SetTextColor(0, 0, 0);25$pdf->SetFont('helvetica', '', 10);

Full Screen

Full Screen

pts_pdf_template

Using AI Code Generation

copy

Full Screen

1include_once("pts_pdf_template.php");2$pdf = new pts_pdf_template();3$pdf->set_template("template.pdf");4$pdf->set_data(array(5));6$pdf->create_pdf();7$pdf->download_pdf("my_file.pdf");

Full Screen

Full Screen

pts_pdf_template

Using AI Code Generation

copy

Full Screen

1include '/usr/share/phoronix-test-suite/pts-core/objects/pts_pdf_template.php';2$pts_pdf_template = new pts_pdf_template('A4', 'P', 'mm');3$pts_pdf_template->SetMargins(20, 20, 20, 20);4$pts_pdf_template->SetAutoPageBreak(true, 20);5$pts_pdf_template->setImageScale(1.53);6$pts_pdf_template->SetFont('helvetica', '', 9);7$pts_pdf_template->AddPage();8$pts_pdf_template->SetTextColor(0, 0, 0);9$pts_pdf_template->SetFillColor(255, 255, 255);10$pts_pdf_template->SetLineWidth(0.1);11$pts_pdf_template->SetFont('helvetica', '', 10);12$pts_pdf_template->SetTitle('PDF Title');13$pts_pdf_template->SetSubject('PDF Subject');14$pts_pdf_template->SetKeywords('PDF Keywords');15$pts_pdf_template->SetAuthor('PDF Author');16$pts_pdf_template->SetCreator('PDF Creator');17$pts_pdf_template->SetHeaderData('logo.png', 10, 'PDF Header Text', 'PDF Header Sub-Text');18$pts_pdf_template->setHeaderFont(Array('helvetica', '', 9));19$pts_pdf_template->setFooterFont(Array('helvetica', '', 9));20$pts_pdf_template->SetHeaderMargin(10);21$pts_pdf_template->SetFooterMargin(10);22$pts_pdf_template->SetDefaultMonospacedFont('courier');23$pts_pdf_template->SetMargins(20, 27, 20);24$pts_pdf_template->SetAutoPageBreak(TRUE, 25);

Full Screen

Full Screen

pts_pdf_template

Using AI Code Generation

copy

Full Screen

1include_once('pts_pdf_template.php');2$pdf = new pts_pdf_template();3$pdf->setTemplateFile('2.pdf_template');4$pdf->setDataFile('2.pdf_data');5$pdf->setOutputFile('2.pdf');6$pdf->create();7For the template file (2.pdf_template) I used the following:8$PageSize = 'A4';9$PageOrientation = 'P';10$PageMargins = array(20, 20, 20, 20);11$Font = 'Arial';12$FontSize = 10;13$FontStyle = '';14$FontColor = '0,0,0';15$LineHeight = 5;16$CellPadding = 1;17$CellBorder = 0;18$CellBorderColor = '0,0,0';19$CellBackgroundColor = '255,255,255';20$CellAlignment = 'L';21$CellText = 'This is the first line of text.';22$CellWidth = 0;23$CellHeight = 0;24$CellX = 0;25$CellY = 0;26For the data file (2.pdf_data) I used the following:

Full Screen

Full Screen

pts_pdf_template

Using AI Code Generation

copy

Full Screen

1require_once('pts_pdf_template.php');2$pts_pdf_template = new pts_pdf_template();3$pts_pdf_template->set_template_file('template1.pdf');4$data = array(5array('Cell 1', 'Cell 2', 'Cell 3'),6array('Cell 4', 'Cell 5', 'Cell 6'),7array('Cell 7', 'Cell 8', 'Cell 9')8);9$pts_pdf_template->set_data($data);10$pts_pdf_template->set_output_file('output1.pdf');

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Run Selenium Automation Tests on LambdaTest Cloud Grid

Trigger Selenium automation tests on a cloud-based Grid of 3000+ real browsers and operating systems.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful