How to use CreateBookmark method of pts_pdf_template class

Best Phoronix-test-suite code snippet using pts_pdf_template.CreateBookmark

pts_pdf_template.php

Source:pts_pdf_template.php Github

copy

Full Screen

...51 $section_title = $dom->getElementsByTagName('html')->item(0)->getElementsByTagName('head')->item(0)->nodeValue;52 $tags = $dom->getElementsByTagName('html')->item(0)->getElementsByTagName('body')->item(0)->childNodes;53 $this->SetLeftMargin(8.5);54 $this->AddPage();55 $this->CreateBookmark($section_title, 0);56 $this->SetFont('Arial', 'B', 21);57 $this->SetTextColor(50, 51, 49);58 $this->SetFillColor(255, 255, 255);59 $this->Cell(0, 6, $section_title, 0, 0, 'L', true);60 $this->Ln(10);61 for($i = 0; $i < $tags->length; $i++)62 {63 $name = $tags->item($i)->nodeName;64 $value = $tags->item($i)->nodeValue;65 $dom_item = $tags->item($i);66 switch($name)67 {68 case 'h1':69 $this->CreateBookmark($value, 1);70 $this->SetFont('Arial', 'B', 16);71 $this->SetLeftMargin(8.5);72 $this->SetTextColor(232, 143, 9);73 $this->Ln();74 $this->html_text_interpret('h1', $dom_item);75 $this->Ln();76 break;77 case 'h2':78 $this->CreateBookmark($value, 2);79 $this->SetLeftMargin(10);80 $this->SetFont('Arial', 'B', 14);81 $this->SetTextColor(129, 140, 3);82 $this->Ln();83 $this->SetTopMargin(30);84 $this->html_text_interpret('h2', $dom_item);85 $this->Ln();86 break;87 case 'h3':88 $this->SetLeftMargin(10);89 $this->SetFont('Arial', 'B', 13);90 $this->SetTextColor(129, 140, 3);91 $this->Ln();92 $this->html_text_interpret('h3', $dom_item);93 $this->SetLeftMargin(10);94 $this->Ln();95 break;96 case 'ol':97 case 'ul':98 $this->SetFont('Arial', null, 11);99 $this->SetLeftMargin(30);100 $this->SetTextColor(0, 0, 0);101 $this->Ln();102 foreach($tags->item($i)->childNodes as $j => $li)103 {104 if($name == 'ol' && ($j % 2) == 0)105 {106 $this->SetFont(null, 'B');107 $this->Write(5, ceil($j / 2) + 1 . '. ', null);108 $this->SetFont(null, null);109 }110 $this->html_text_interpret('p', $li);111 $this->Ln();112 }113 $this->SetLeftMargin(10);114 $this->Ln();115 break;116 case 'li':117 $this->SetFont('Arial', null, 11);118 $this->SetLeftMargin(30);119 $this->SetTextColor(0, 0, 0);120 $this->html_text_interpret('li', $dom_item);121 $this->Ln();122 break;123 case 'p':124 $this->SetFont('Arial', null, 11);125 $this->SetLeftMargin(20);126 $this->SetTextColor(0, 0, 0);127 $this->Ln();128 $this->html_text_interpret('p', $dom_item);129 $this->SetLeftMargin(10);130 $this->Ln();131 break;132 case 'hr':133 $this->Ln(8);134 break;135 }136 }137 }138 protected function html_text_interpret($apply_as_tag, &$dom_item)139 {140 for($j = 0; property_exists($dom_item, 'length') == false && $j < $dom_item->childNodes->length; $j++)141 {142 $value = $dom_item->childNodes->item($j)->nodeValue;143 $name = $dom_item->childNodes->item($j)->nodeName;144 switch($name)145 {146 case 'em':147 $this->SetFont(null, 'I', (substr($apply_as_tag, 0, 1) == 'h' ? '12' : null));148 break;149 case 'u':150 $this->SetFont(null, 'U', (substr($apply_as_tag, 0, 1) == 'h' ? '12' : null));151 break;152 case 'strong':153 $this->SetFont(null, 'B');154 break;155 case '#text':156 $this->SetFont(null, (substr($apply_as_tag, 0, 1) == 'h' ? 'B' : null));157 break;158 case 'a':159 $this->SetTextColor(0, 0, 116);160 $this->SetFont(null, 'BU');161 $this->Write(5, $value, $dom_item->childNodes->item($j)->attributes->getNamedItem('href')->nodeValue);162 $this->SetTextColor(0, 0, 0);163 break;164 default:165 //echo "UNSUPPORTED: $name: $value\n";166 break;167 }168 if($name != 'a')169 {170 $this->Write(5, $value, null);171 }172 }173 }174 public function Header()175 {176 if($this->PageNo() == 1)177 {178 return;179 }180 if(is_file(PTS_CORE_STATIC_PATH . 'images/pts-158x82.jpg'))181 {182 $this->Image(PTS_CORE_STATIC_PATH . 'images/pts-158x82.jpg', 10, 8, 30);183 }184 $this->SetFont('Arial', 'B', 14);185 $this->SetTextColor(0, 0, 0);186 $this->Cell(80);187 $this->Cell(30, 10, $this->pts_title, 0, 0, 'C');188 $this->Ln(6);189 $this->SetFont('Arial', 'B', 10);190 $this->Cell(0, 10, $this->pts_sub_title, 0, 0, 'C');191 $this->Ln(15);192 }193 public function Footer()194 {195 if($this->PageNo() == 1)196 {197 return;198 }199 $this->SetY(-10);200 $this->SetFont('Arial', 'B', 7);201 $this->SetTextColor(0, 0, 0);202 $this->Cell(0, 0, pts_core::program_title(), 0, 0, 'L');203 $this->Cell(0, 0, 'www.phoronix-test-suite.com', 0, 0, 'R', true, 'http://www.phoronix-test-suite.com/');204 }205 public function WriteBigHeaderCenter($Header)206 {207 $this->WriteBigHeader($Header, 'C');208 }209 public function WriteBigHeader($Header, $Align = 'L')210 {211 $this->SetFont('Arial', 'B', 21);212 $this->SetFillColor(255, 255, 255);213 $this->Cell(0, 6, $Header, 0, 0, $Align, true);214 $this->Ln(15);215 }216 public function WriteHeaderCenter($Header)217 {218 $this->WriteHeader($Header, 'C');219 }220 public function WriteHeader($Header, $Align = 'L')221 {222 $this->SetFont('Arial', 'B', 16);223 $this->SetFillColor(255, 255, 255);224 $this->Cell(0, 6, $Header, 0, 0, $Align, true);225 $this->Ln(10);226 }227 public function WriteStatementCenter($Header)228 {229 $this->WriteStatement($Header, 'C');230 }231 public function WriteStatement($Header, $Align = 'L', $Link = null)232 {233 $this->SetFont('Arial', 'B', 14);234 $this->SetFillColor(255, 255, 255);235 $this->Cell(0, 2, $Header, 0, 0, $Align, true, $Link);236 $this->Ln(10);237 }238 public function WriteMiniHeader($Header)239 {240 $this->SetFont('Arial', 'B', 13);241 $this->SetFillColor(255, 255, 255);242 $this->Cell(0, 2, $Header, 0, 0, 'L', true);243 $this->Ln(5);244 }245 public function WriteDocHeader($Header, $Options = null)246 {247 $this->SetFont('Arial', 'B', 12);248 $this->SetFillColor(255, 255, 255);249 $this->Write(12, $Header);250 if(is_array($Options))251 {252 $this->Write(12, ' ');253 $this->SetFont('Arial', 'I', 10);254 $this->Write(12, implode(' ', $Options));255 }256 $this->Ln(10);257 }258 public function WriteDocText($Text)259 {260 $this->SetFont('Arial', '', 10);261 $this->MultiCell(0, 5, $Text);262 }263 public function WriteText($Text)264 {265 $this->SetFont('Arial', '', 11);266 $this->MultiCell(0, 5, $Text);267 $this->Ln();268 }269 public function ResultTable($headers, $data, $left_headers = '')270 {271 $this->Ln(20);272 $this->SetFillColor(0, 0, 0);273 $this->SetTextColor(255, 255, 255);274 $this->SetDrawColor(34, 34, 34);275 $this->SetLineWidth(0.3);276 $this->SetFont('Arial', 'B');277 $cell_width = 50;278 $cell_large_width = $cell_width * 1.20;279 $table_width = 0;280 if(is_array($left_headers) && count($left_headers) > 0)281 {282 $this->Cell($cell_large_width, 7, '', 1, 0, 'C', true);283 $table_width += $cell_large_width;284 }285 for($i = 0; $i < count($headers); $i++)286 {287 $this->Cell($cell_width, 7, $headers[$i], 1, 0, 'C', true);288 }289 $this->Ln();290 $this->SetFillColor(139, 143, 124);291 $this->SetTextColor(0);292 $this->SetFont('Arial');293 $fill = false;294 for($i = 0; $i < count($data) || $i < count($left_headers); $i++)295 {296 if(isset($left_headers[$i]))297 {298 $this->Cell($cell_large_width, 6, $left_headers[$i], 'LR', 0, 'L', $fill);299 }300 if(!isset($data[$i]))301 {302 $data[$i] = array();303 }304 for($j = 0; $j < count($data[$i]); $j++)305 {306 $this->Cell($cell_width, 6, $data[$i][$j], 'LR', 0, 'L', $fill);307 }308 $this->Ln();309 $fill = !$fill;310 }311 $this->Cell($table_width + (count($data[0]) * $cell_width), 0, '', 'T');312 }313 public function _putinfo()314 {315 $this->_out('/Producer ' . $this->_textstring('Phoronix Test Suite'));316 $this->_out('/Subject ' . $this->_textstring('Phoronix-Test-Suite.com'));317 $this->_out('/Title ' . $this->_textstring($this->title));318 $this->_out('/Subject ' . $this->_textstring($this->subject));319 $this->_out('/Author ' . $this->_textstring($this->author));320 $this->_out('/Keywords ' . $this->_textstring($this->keywords));321 $this->_out('/Creator ' . $this->_textstring($this->creator));322 $this->_out('/CreationDate ' . $this->_textstring('D:' . date('YmdHis')));323 }324 // PDF Bookmarking Support325 // Example: http://www.fpdf.org/en/script/script1.php326 public function CreateBookmark($bookmark, $level = 0)327 {328 $this->pdf_bookmarks[] = array(329 't' => $bookmark,330 'l' => $level,331 'y' => (($this->h - $this->getY()) * $this->k),332 'p' => $this->PageNo()333 );334 }335 protected function insert_pdf_bookmarks()336 {337 $bookmark_count = count($this->pdf_bookmarks);338 $level = 0;339 $ls = array();340 foreach($this->pdf_bookmarks as $i => &$o)...

Full Screen

Full Screen

CreateBookmark

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->CreateBookmark('Test Bookmark', 0, -1);4require_once('pts_pdf_template.php');5$pts_pdf_template = new pts_pdf_template();6$pts_pdf_template->CreateBookmark('Test Bookmark', 2, -1);7require_once('pts_pdf_template.php');8$pts_pdf_template = new pts_pdf_template();9$pts_pdf_template->CreateBookmark('Test Bookmark', 2, 1);10require_once('pts_pdf_template.php');11$pts_pdf_template = new pts_pdf_template();12$pts_pdf_template->CreateBookmark('Test Bookmark', 2, 2);13require_once('pts_pdf_template.php');14$pts_pdf_template = new pts_pdf_template();15$pts_pdf_template->CreateBookmark('Test Bookmark', 2, 3);16require_once('pts_pdf_template.php');17$pts_pdf_template = new pts_pdf_template();18$pts_pdf_template->CreateBookmark('Test Bookmark', 2, 4);19require_once('pts_pdf_template.php');20$pts_pdf_template = new pts_pdf_template();21$pts_pdf_template->CreateBookmark('Test Bookmark', 2, 5);22require_once('pts_pdf_template.php');23$pts_pdf_template = new pts_pdf_template();24$pts_pdf_template->CreateBookmark('Test Bookmark', 2, 6);25require_once('pts_pdf_template.php');26$pts_pdf_template = new pts_pdf_template();27$pts_pdf_template->CreateBookmark('Test Bookmark', 2, 7);28require_once('

Full Screen

Full Screen

CreateBookmark

Using AI Code Generation

copy

Full Screen

1require_once('pts_pdf_template.php');2$bookmarks = array();3$bookmarks['1'] = array('name'=>'Chapter 1','page'=>1);4$bookmarks['2'] = array('name'=>'Chapter 2','page'=>1);5$bookmarks['2.1'] = array('name'=>'Section 2.1','page'=>1);6$bookmarks['2.2'] = array('name'=>'Section 2.2','page'=>1);7$bookmarks['2.2.1'] = array('name'=>'Subsection 2.2.1','page'=>1);8$bookmarks['2.2.2'] = array('name'=>'Subsection 2.2.2','page'=>1);9$bookmarks['2.2.3'] = array('name'=>'Subsection 2.2.3','page'=>1);10$bookmarks['3'] = array('name'=>'Chapter 3','page'=>1);11$bookmarks['3.1'] = array('name'=>'Section 3.1','page'=>1);12$bookmarks['3.2'] = array('name'=>'Section 3.2','page'=>1);13$bookmarks['3.3'] = array('name'=>'Section 3.3','page'=>1);14$bookmarks['3.3.1'] = array('name'=>'Subsection 3.3.1','page'=>1);15$bookmarks['3.3.2'] = array('name'=>'Subsection 3.3.2','page'=>1);

Full Screen

Full Screen

CreateBookmark

Using AI Code Generation

copy

Full Screen

1$pts_pdf_template = new pts_pdf_template();2$pts_pdf_template->CreateBookmark('2.php', '2.php', 0, 0, 0, 0, 0, 0, 0);3$pts_pdf_template = new pts_pdf_template();4$pts_pdf_template->CreateBookmark('3.php', '3.php', 0, 0, 0, 0, 0, 0, 0);5$pts_pdf_template = new pts_pdf_template();6$pts_pdf_template->CreateBookmark('4.php', '4.php', 0, 0, 0, 0, 0, 0, 0);7$pts_pdf_template = new pts_pdf_template();8$pts_pdf_template->CreateBookmark('5.php', '5.php', 0, 0, 0, 0, 0, 0, 0);9$pts_pdf_template = new pts_pdf_template();10$pts_pdf_template->CreateBookmark('6.php', '6.php', 0, 0, 0, 0, 0, 0, 0);11$pts_pdf_template = new pts_pdf_template();12$pts_pdf_template->CreateBookmark('7.php', '7.php', 0, 0, 0, 0, 0, 0, 0);13$pts_pdf_template = new pts_pdf_template();14$pts_pdf_template->CreateBookmark('8.php', '8.php', 0, 0, 0, 0, 0, 0, 0);15$pts_pdf_template = new pts_pdf_template();16$pts_pdf_template->CreateBookmark('9.php', '9.php', 0, 0, 0, 0

Full Screen

Full Screen

CreateBookmark

Using AI Code Generation

copy

Full Screen

1require_once('pts_pdf_template.php');2$obj = new pts_pdf_template();3$obj->setTemplateFile('template.pdf');4$obj->CreateBookmark('Chapter 1', 0, -1);5$obj->CreateBookmark('Section 1.1', 1, 0);6$obj->CreateBookmark('Section 1.2', 1, -1);7$obj->CreateBookmark('Section 1.3', 1, -1);8$obj->CreateBookmark('Section 1.4', 1, -1);9$obj->CreateBookmark('Chapter 2', 0, -1);10$obj->CreateBookmark('Section 2.1', 1, 0);11$obj->CreateBookmark('Section 2.2', 1, -1);12$obj->CreateBookmark('Section 2.3', 1, -1);13$obj->CreateBookmark('Section 2.4', 1, -1);14$obj->CreateBookmark('Chapter 3', 0, -1);15$obj->CreateBookmark('Section 3.1', 1, 0);16$obj->CreateBookmark('Section 3.2', 1, -1);17$obj->CreateBookmark('Section 3.3', 1, -1);18$obj->CreateBookmark('Section 3.4', 1, -1);19$obj->CreateBookmark('Chapter 4', 0, -1);20$obj->CreateBookmark('Section 4.1', 1, 0);21$obj->CreateBookmark('Section 4.2', 1, -1);22$obj->CreateBookmark('Section 4.3', 1, -1);23$obj->CreateBookmark('Section 4.4', 1, -1);24$obj->CreateBookmark('Chapter 5', 0, -1);25$obj->CreateBookmark('Section 5.1', 1, 0);

Full Screen

Full Screen

CreateBookmark

Using AI Code Generation

copy

Full Screen

1include("pts_pdf_template.php");2$pts_pdf_template = new pts_pdf_template();3$bookmark_title = "PHP Classes - Create PDF Bookmarks";4$page_number = 1;5$position = "after";6$bookmark_page_number = 1;7$style = "none";8$color = "blue";9$font = "Times-Roman";10$font_size = 12;11$font_style = "normal";12$font_color = "blue";13$font_outline_color = "none";14$font_outline_width = 0;15$font_character_spacing = 0;16$font_word_spacing = 0;17$font_horizontal_scaling = 100;18$font_rise = 0;19$font_text_rendering_mode = 0;20$font_text_knockout = "false";21$font_background_color = "none";22$font_border_color = "none";23$font_border_width = 0;24$font_border_style = "solid";25$font_border_effect = "normal";26$font_border_effect_intensity = 1;27$font_padding = 0;28$font_margin = 0;

Full Screen

Full Screen

CreateBookmark

Using AI Code Generation

copy

Full Screen

1include("pts_pdf_template.php");2$pts_pdf_template = new pts_pdf_template();3$bookmark_title = "PHP Classes - Create PDF Bookmarks";4$page_number = 1;5$position = "after";6$bookmark_page_number = 1;7$style = "none";8$color = "blue";9$font = "Times-Roman";10$font_size = 12;11$font_style = "normal";12$font_color = "blue";13$font_outline_color = "none";14$font_outline_width = 0;15$font_character_spacing = 0;16$font_word_spacing = 0;17$font_horizontal_scaling = 100;18$font_rise = 0;19$font_text_rendering_mode = 0;20$font_text_knockout = "false";21$font_background_color = "none";22$font_border_color = "none";23$font_border_width = 0;24$font_border_style = "solid";25$font_border_effect = "normal";26$font_border_effect_intensity = 1;27$font_padding = 0;28$font_margin = 0;

Full Screen

Full Screen

CreateBookmark

Using AI Code Generation

copy

Full Screen

1require_once('pts_pdf_template.php');2$pdf = new pts_pdf_template();3$pdf->CreateBookmark("Chapter 1",1);4$pdf->CreateBookmark("Chapter 2",2);5$pdf->CreateBookmark("Chapter 3",3);6$pdf->CreateBookmark("Chapter 4",4);7$pdf->CreateBookmark("Chapter 5",5);8$pdf->CreateBookmark("Chapter 6",6);9$pdf->CreateBookmark("Chapter 7",7);10$pdf->CreateBookmark("Chapter 8",8);11$pdf->CreateBookmark("Chapter 9",9);12$pdf->CreateBookmark("Chapter 10",10);13$pdf->CreateBookmark("Chapter 11",11);14$pdf->CreateBookmark("Chapter 12",12);15$pdf->CreateBookmark("Chapter 13",13);16$pdf->CreateBookmark("Chapter 14",14);17$pdf->CreateBookmark("Chapter 15",15);18$pdf->CreateBookmark("Chapter 16",16);

Full Screen

Full Screen

CreateBookmark

Using AI Code Generation

copy

Full Screen

1require_once('pts_pdf_template.php');2$pdf = new pts_pdf_template();3$pdf->CreateBookmark("Chapter 1",1);4$pdf->CreateBookmark("Chapter 2",2);5$pdf->CreateBookmark("Chapter 3",3);6$pdf->CreateBookmark("Chapter 4",4);7$pdf->CreateBookmark("Chapter 5",5);8$pdf->CreateBookmark("Chapter 6",6);9$pdf->CreateBookmark("Chapter 7",7);10$pdf->CreateBookmark("Chapter 8",8);11$pdf->CreateBookmark("Chapter 9",9);12$pdf->CreateBookmark("Chapter 10",10);13$pdf->CreateBookmark("Chapter 11",11);14$pdf->CreateBookmark("Chapter 12",12);15$pdf->CreateBookmark("Chapter 13",13);16$pdf->CreateBookmark("Chapter 14",14);17$pdf->CreateBookmark("Chapter 15",15);18$pdf->CreateBookmark("Chapter 16",16);

Full Screen

Full Screen

CreateBookmark

Using AI Code Generation

copy

Full Screen

1require_once('pts_pdf_template.php');2$pdf = new pts_pdf_template();3$pdf->pdf_file_name = "bookmark.pdf";4$pdf->pdf_file_name = "bookmark.pdf";5$pdf->pdf_title = "Bookmark";6$pdf->pdf_subject = "Bookmark";7$pdf->pdf_author = "PHP PDF Template";8$pdf->pdf_creator = "PHP PDF Template";9$pdf->pdf_keywords = "PHP PDF Template";10$pdf->pdf_page_size = "A4";11$pdf->pdf_page_orientation = "P";12$pdf->pdf_compression = true;13$pdf->pdf_margin = 10;14$pdf->pdf_header = "";15$pdf->pdf_footer = "";16$pdf->pdf_font = "Arial";17$pdf->pdf_font_size = 12;18$pdf->pdf_font_style = "B";19$pdf->pdf_font_color = "#000000";

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.

Trigger CreateBookmark code on LambdaTest Cloud Grid

Execute automation tests with CreateBookmark on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

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