<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


    // we can have any view part here like HTML, PHP etc
   // create some HTML content

$html = '';
$title = "";
if ($content) {
 foreach ($content as $row) {
     $html = $row->content;
     $title = $row->title;
 }
 $html .= '<h3 style="margin-top:-10px;">Video Links</h3>
                                    <ul>';
                                                if ($videoLinks) {
                                                    foreach ($videoLinks as $rowV) {
                                                     
                                             $html .='<li> <a href="'.base_url().$rowV->videoLink.'">'.$rowV->title.'</a></li>';
                                                    
                                                    }
                                                }
                                        $html .= '</ul>';
                               $html .= '
                                        <h3 style="margin-top:-10px;">Related Topic</h3>
                                        <ul>';
                                                if ($relatedTopic) {
                                                    $this->lang->load("ug_topic",$this->session->userdata('language'));
                                                    foreach ($relatedTopic as $rowT) {
                                                       
                                        $html .= '<li> <a href="#">'.$this->lang->line($rowT->name).'</a></li>';
                                                   
                                                    }
                                                }
                                          $html .= '     
                                        </ul>';
}

tcpdf();
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);

$obj_pdf->SetTitle($title);
$obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, 'Guide Auto Generated');
$obj_pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$obj_pdf->SetFont('helvetica', '', 9);
$obj_pdf->setFontSubsetting(false);
$obj_pdf->AddPage();
ob_start();

ob_end_clean();
$obj_pdf->writeHTML($html, true, false, true, false, '');
$obj_pdf->Output('output.pdf', 'I');

?>