Example #1
14
 function convertHtmlToPdf($html)
 {
     if (!$html) {
         throw new \Exception("Html Not Given");
     }
     $pagelayout = array($this->options['width'], $this->options['height']);
     //  or array($width,$height)
     $pdf = new \TCPDF('l', 'px', $pagelayout, true, 'UTF-8', false);
     $pdf->SetMargins(0, 0, 0);
     $pdf->SetHeaderMargin(0);
     $pdf->SetFooterMargin(0);
     // $pdf = new \TCPDF_TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetAutoPageBreak(false);
     if ($this->options['header_font_family']) {
         $pdf->SetFont($this->options['header_font_family']);
     }
     // add a page
     $pdf->AddPage();
     $pdf->WriteHTML($html, true, false, true, false);
     $this->pdf = $pdf->Output(null, 'S');
     //for test
     // $this->pdf = $pdf->Output(null);
     // echo $this->pdf;
     // exit;
 }
Example #2
1
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $dispatcher =& JDispatcher::getInstance();
     /* Load the event details */
     $course = $this->get('Details');
     $venue = $this->get('Venue');
     $pdf = new TCPDF("P", "mm", "A4", true);
     $pdf->SetCreator($mainframe->getCfg('sitename'));
     $pdf->SetAuthor($mainframe->getCfg('sitename'));
     $pdf->SetTitle($course->title);
     $pdf->SetSubject($course->title);
     $pdf->setHeaderFont(array('freesans', '', 8));
     $pdf->setFooterFont(array('freesans', '', 8));
     $pdf->setFont('freesans');
     // disable header and footer
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(true);
     //set the display mode
     $pdf->SetDisplayMode('default');
     //initialize document
     $pdf->AliasNbPages();
     // add a page
     $pdf->AddPage();
     $pdf->SetFontSize(10);
     /* This loads the tags replacer */
     JView::loadHelper('tags');
     $tags = new redEVENT_tags();
     $tags->setXref(JRequest::getInt('xref'));
     $message = $tags->ReplaceTags($course->submission_type_email_pdf);
     // convert urls
     $htmlmsg = REOutput::ImgRelAbs($message);
     $pdf->WriteHTML($message, true);
     // add the form data if requested
     if ($course->pdf_form_data) {
         JRequest::setVar('pdfform', $pdf);
         JPluginHelper::importPlugin('content');
         $form = new stdClass();
         $form->text = '{redform}' . $course->redform_id . ',1{/redform}';
         $form->eventid = $course->did;
         $form->task = 'userregister';
         $results = $dispatcher->trigger('onPrepareEvent', array(&$form, array(), 0));
         $pdf->WriteHTML($form->text, true);
     }
     // output the file
     $pdf->Output($course->title . ".pdf", "I");
     exit;
 }
Example #3
1
 public function display($tpl = null)
 {
     $this->app = JFactory::getApplication();
     $this->params = $this->app->getParams('com_rsform');
     $this->template = $this->get('template');
     $this->directory = $this->get('directory');
     if (!$this->directory->enablepdf) {
         JError::raiseWarning(500, JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect(JURI::root());
     }
     parent::display($tpl);
     if (class_exists('plgSystemRSFPPDF')) {
         /**
          *	DOMPDF Library
          */
         require_once JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/pdf/pdf.php';
         $pdf = new RSFormPDF();
         // Build the PDF Document string from the document buffer
         header('Content-Type: application/pdf; charset=utf-8');
         header('Content-disposition: inline; filename="export.pdf"', true);
         $contents = '<link rel="stylesheet" href="' . JPATH_SITE . '/components/com_rsform/assets/css/directory.css" type="text/css"/>';
         $contents .= ob_get_contents();
         $pdf->write('export.pdf', $contents, true);
         jexit();
     } else {
         /*
          * Setup external configuration options
          */
         define('K_TCPDF_EXTERNAL_CONFIG', true);
         define("K_PATH_MAIN", JPATH_LIBRARIES . "/tcpdf");
         define("K_PATH_URL", JPATH_BASE);
         define("K_PATH_FONTS", K_PATH_MAIN . '/fonts/');
         define("K_PATH_CACHE", K_PATH_MAIN . "/cache");
         define("K_PATH_URL_CACHE", K_PATH_URL . "/cache");
         define("K_PATH_IMAGES", K_PATH_MAIN . "/images");
         define("K_BLANK_IMAGE", K_PATH_IMAGES . "/_blank.png");
         define("K_CELL_HEIGHT_RATIO", 1.25);
         define("K_TITLE_MAGNIFICATION", 1.3);
         define("K_SMALL_RATIO", 2 / 3);
         define("HEAD_MAGNIFICATION", 1.1);
         /*
          * Create the pdf document
          */
         jimport('tcpdf.tcpdf');
         $pdf = new TCPDF();
         $pdf->SetMargins(15, 27, 15);
         $pdf->SetAutoPageBreak(true, 25);
         $pdf->SetHeaderMargin(5);
         $pdf->SetFooterMargin(10);
         $pdf->setImageScale(4);
         $document = JFactory::getDocument();
         // Set PDF Metadata
         $pdf->SetCreator($document->getGenerator());
         $pdf->SetTitle($document->getTitle());
         $pdf->SetSubject($document->getDescription());
         $pdf->SetKeywords($document->getMetaData('keywords'));
         // Set PDF Header data
         $pdf->setHeaderData('', 0, $document->getTitle(), null);
         // Set RTL
         $lang = JFactory::getLanguage();
         $pdf->setRTL($lang->isRTL());
         // Set Font
         $font = 'freesans';
         $pdf->setHeaderFont(array($font, '', 10));
         $pdf->setFooterFont(array($font, '', 8));
         // Initialize PDF Document
         if (is_callable(array($pdf, 'AliasNbPages'))) {
             $pdf->AliasNbPages();
         }
         $pdf->AddPage();
         $contents .= ob_get_contents();
         $pdf->WriteHTML($contents, true);
         $data = $pdf->Output('', 'S');
         ob_end_clean();
         // Build the PDF Document string from the document buffer
         header('Content-Type: application/pdf; charset=utf-8');
         header('Content-disposition: attachment; filename="export.pdf"', true);
         echo $data;
         die;
     }
 }
function nv_giapha_export_pdf($contents, $background, $row_genealogy)
{
    global $db, $db_config, $lang_module, $lang_global, $module_name, $module_data;
    require_once NV_ROOTDIR . '/includes/class/phpPdf/config/lang/eng.php';
    require_once NV_ROOTDIR . '/includes/class/phpPdf/tcpdf.php';
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor('Nicola Asuni');
    $pdf->SetTitle('TCPDF Example 001');
    $pdf->SetSubject('TCPDF Tutorial');
    $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
    $pdf->SetFont('dejavusans', '', 14, '', true);
    // set default header data
    $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $row_genealogy['title'], $row_genealogy['full_name'] . ' - ' . $row_genealogy['email']);
    // set header and footer fonts
    $pdf->setHeaderFont(array('dejavusans', '', PDF_FONT_SIZE_MAIN));
    $pdf->setFooterFont(array('dejavusans', '', PDF_FONT_SIZE_DATA));
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    //set margins
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    //set auto page breaks
    $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
    //set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    //set some language-dependent strings
    $pdf->setLanguageArray($l);
    // ---------------------------------------------------------
    // set default font subsetting mode
    $pdf->setFontSubsetting(true);
    // Set font
    // dejavusans is a UTF-8 Unicode font, if you only need to
    // print standard ASCII chars, you can use core fonts like
    // helvetica or times to reduce file size.
    // Add a page
    // This method has several options, check the source code documentation for more information.
    $pdf->AddPage();
    if (!empty($contents['biagp'])) {
        if (!empty($background) && file_exists($background)) {
            // -- set new background ---
            // get the current page break margin
            $bMargin = $pdf->getBreakMargin();
            // get current auto-page-break mode
            $auto_page_break = $pdf->getAutoPageBreak();
            // disable auto-page-break
            $pdf->SetAutoPageBreak(false, 0);
            // set bacground image
            $pdf->Image($background, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
            // restore auto-page-break status
            $pdf->SetAutoPageBreak($auto_page_break, $bMargin);
            // set the starting point for the page content
            $pdf->setPageMark();
        }
        //============================================================+
        // END OF FILE
        //============================================================+
        // Persian and English content
        $pdf->WriteHTML($contents['biagp'], true, 0, true, 0);
    }
    if ($contents['phaky']) {
        // output the HTML content
        $pdf->WriteHTML("<h2><i style=\"color:#990000;text-decoration: underline;\">Phả ký</i></h2>", true, 0, true, 0);
        $pdf->Ln(2);
        $pdf->WriteHTML("<span style=\"font-size:35px;\">" . $contents['phaky'] . "</span>", true, 0, true, 0);
    }
    if ($contents['phado']) {
        // output the HTML content
        $pdf->WriteHTML("<h2><i style=\"color:#990000;text-decoration: underline;\">Phả đồ</i></h2>", true, 0, true, 0);
        $pdf->Ln(2);
        foreach ($contents['phado'] as $phado) {
            $pdf->writeHTML($phado, true, false, true, false, '');
        }
    }
    if ($contents['tocuoc']) {
        // output the HTML content
        $pdf->WriteHTML("<h2><i style=\"color:#990000;text-decoration: underline;\">Tộc ước</i></h2>", true, 0, true, 0);
        $pdf->Ln(2);
        $pdf->WriteHTML($contents['tocuoc'], true, 0, true, 0);
    }
    if ($contents['huonghoa']) {
        // output the HTML content
        $pdf->WriteHTML("<h2><i style=\"color:#990000;text-decoration: underline;\">Hương hỏa</i></h2>", true, 0, true, 0);
        $pdf->Ln(2);
        $pdf->WriteHTML($contents['huonghoa'], true, 0, true, 0);
    }
    if ($contents['ngaygio']) {
        // output the HTML content
        $pdf->WriteHTML("<h2><i style=\"color:#990000;text-decoration: underline;\">Ngày giỗ</i></h2>", true, 0, true, 0);
        $pdf->Ln(2);
        $pdf->SetFillColor(221, 238, 255);
        if (empty($array_data) && empty($array_anniversary)) {
            $pdf->Cell(0, 10, 'Không có dữ liệu', 1, 1, 'C', true, '', 0, false, 'T', 'M');
        } else {
            $array_data = $contents['ngaygio']['genealogy'];
            $array_anniversary = $contents['ngaygio']['anniversary'];
            // print font name
            $pdf->Cell(0, 10, 'Ngày giỗ:' . $array_data['title'], 1, 1, 'C', true, '', 0, false, 'T', 'M');
            $pdf->SetFillColor(168, 164, 204);
            $pdf->Cell(20, 12, 'STT', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(110, 12, 'Họ tên', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(50, 12, 'Ngày giỗ', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Ln();
            // set font for chars
            $pdf->SetFont($font, '', 16);
            $i = 0;
            foreach ($array_anniversary as $row) {
                $i++;
                $row['number'] = $i;
                $pdf->Cell(20, 12, $row['number'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Cell(110, 12, $row['full_name'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Cell(50, 12, $row['date'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Ln();
            }
        }
        $pdf->Ln(10);
    }
    if ($contents['thanhvien']) {
        //array allow
        $array_key = array('image', 'full_name', 'gender', 'status', 'code', 'name1', 'name2', 'birthday', 'dieday', 'life', 'burial');
        $row_detail = $contents['thanhvien']['detail'];
        $pdf->SetFillColor(221, 238, 255);
        // print font name
        $pdf->Cell(0, 10, 'Trưởng họ', 1, 1, 'C', true, '', 0, false, 'T', 'M');
        // set font for chars
        $pdf->SetFont($font, '', 13);
        $pdf->SetFontSize(13);
        foreach ($array_key as $key) {
            if ($row_detail[$key] != "") {
                if ($key == "image") {
                    $pdf->Cell(80, 40, $lang_module['u_' . $key], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                    $pdf->Image($row_detail[$key], '', '', 40, 40, '', '', 'L', false, 150, '', false, false, 0, false, false, false);
                    $pdf->Cell(100, 40, '', 1, 0, 'R', false, '', 0, false, '', '');
                } else {
                    $pdf->Cell(80, 12, $lang_module['u_' . $key], 1, 0, 'C', true, '', 0, false, 'T', 'M');
                    $pdf->Cell(100, 12, $row_detail[$key], 1, 0, 'L', true, '', 1, false, 'T', 'M');
                }
                $pdf->Ln();
            }
        }
        if (!empty($row_detail['content'])) {
            $pdf->Ln(10);
            $pdf->WriteHTML("<h1><i style=\"color:#990000;\">" . $lang_module['u_content'] . "</i></h1>", true, 0, true, 0);
            $pdf->Ln(2);
            $pdf->WriteHTML($row_detail['content']);
        }
        $array_parentid = $contents['thanhvien']['parentid'];
        foreach ($array_parentid as $array_parentid_i) {
            $pdf->Ln(10);
            $pdf->SetFillColor(221, 238, 255);
            $pdf->Cell(180, 10, $array_parentid_i['caption'], 1, 1, 'C', true, '', 0, false, 'T', 'M');
            $pdf->SetFillColor(168, 164, 204);
            $pdf->Cell(10, 12, 'STT', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(78, 12, 'Họ tên', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(30, 12, 'Ngày sinh', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(12, 12, 'Ảnh', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(25, 12, 'Giới tính', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(25, 12, 'Trạng thái', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Ln();
            $items = $array_parentid_i['items'];
            $number = 1;
            foreach ($items as $item) {
                $item['number'] = $number++;
                $pdf->Cell(10, 12, $item['number'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Cell(78, 12, $item['full_name'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Cell(30, 12, $item['birthday'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Image($item['image'], '', '', 12, 12, '', '', 'L', false, 150, '', false, false, 0, false, false, false);
                $pdf->Cell(12, 12, '', 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Cell(25, 12, $item['gender'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Cell(25, 12, $item['status'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Ln();
            }
        }
    }
    if ($contents['chitiet']) {
        // output the HTML content
        $pdf->WriteHTML("<h3><i style=\"color:#990000;text-decoration: underline;\">Thông tin chi tiết</i></h3>", true, 0, true, 0);
        $pdf->Ln(2);
        $pdf->WriteHTML($contents['chitiet']['them'], true, 0, true, 0);
        $array_parentid = $contents['chitiet']['array_parentid'];
        foreach ($array_parentid as $array_parentid_i) {
            $pdf->Ln(10);
            $pdf->SetFillColor(221, 238, 255);
            $pdf->Cell(180, 10, $array_parentid_i['caption'], 1, 1, 'C', true, '', 0, false, 'T', 'M');
            $pdf->SetFillColor(168, 164, 204);
            $pdf->Cell(10, 12, 'STT', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(78, 12, 'Họ tên', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(30, 12, 'Ngày sinh', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(12, 12, 'Ảnh', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(25, 12, 'Giới tính', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Cell(25, 12, 'Trạng thái', 1, 0, 'C', true, '', 0, false, 'T', 'M');
            $pdf->Ln();
            $items = $array_parentid_i['items'];
            $number = 1;
            foreach ($items as $item) {
                $item['number'] = $number++;
                $pdf->Cell(10, 12, $item['number'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Cell(78, 12, $item['full_name'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Cell(30, 12, $item['birthday'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Image($item['image'], '', '', 12, 12, '', '', 'L', false, 150, '', false, false, 0, false, false, false);
                $pdf->Cell(12, 12, '', 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Cell(25, 12, $item['gender'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Cell(25, 12, $item['status'], 1, 0, 'C', false, '', 0, false, 'T', 'M');
                $pdf->Ln();
            }
        }
    }
    // set LTR direction for english translation
    $pdf->setRTL(false);
    $pdf->SetFontSize(10);
    // print newline
    $pdf->Ln();
    //Close and output PDF document
    $pdf->Output($row_genealogy['alias'], 'I');
}
Example #5
0
 static function printTicket($ticket_html, $order)
 {
     ob_end_clean();
     $config = JComponentHelper::getParams('com_bookpro');
     $page_ticket = "<h1 color='Red'> Wellcome to tcpdf </h1>";
     $page_ticket = $ticket_html;
     // create new PDF document
     $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
     $order_number = $order->order_number;
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Joombooking');
     $pdf->SetTitle('Travel Ticket ' . $order_number);
     $pdf->SetSubject('Travel Ticket');
     $pdf->SetKeywords('TCPDF, PDF, ticket, travel, booking');
     // set default header data
     //$pdf->SetHeaderData($config->get('company_logo'),50, $config->get('company_name'), "Ticket \n www.");
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     //$pdf->setHeaderMargin(10);
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     //$pdf->SetMargins(30, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     //$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('times', '', 11);
     // add a page
     $pdf->AddPage();
     // set JPEG quality
     $pdf->setJPEGQuality(75);
     $style['position'] = 'R';
     /*
      *     $type type of barcode (see tcpdf_barcodes_1d.php for supported formats).
      *      
      */
     //$pdf->write1DBarcode($order_number, 'C128B','', '', '', 10, 0.4, $style, 'M');
     // create some HTML content
     //$pdf->writeHTML($htmlcontent, true, 0, true, 0);
     //$pdf->WriteHTML(file_get_contents('test.html'));
     $pdf->WriteHTML($page_ticket);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // reset pointer to the last page
     $pdf->lastPage();
     // ---------------------------------------------------------
     //Close and output PDF document
     ob_end_clean();
     $pdf->Output($order->name . '.pdf', 'I');
     //Should use variable to make file name
     ob_end_flush();
 }
Example #6
0
    function orderViewPDF()
    {
   		$l = null;
    	require_once(OSEMSC_F_PATH.DS.'libraries'.DS.'tcpdf'.DS.'tcpdf.php');
    	require_once(OSEMSC_F_PATH.DS.'libraries'.DS.'tcpdf'.DS.'config'.DS.'lang'.DS.'eng.php');

    	$order_id = JRequest::getInt('order_id',0);

    	$my = JFactory::getUser();

		$where = array();
		$where[] = " `order_id` = {$order_id}";
		$where[] = " `user_id` = {$my->id}";

		$orderInfo = oseRegistry::call('payment')->getOrder($where,'obj');

		if(empty($orderInfo))
		{
			$result = array();
			$result['title'] = 'Error';
			$result['content'] = 'Error';

			oseExit('Error');
		}

		$receipt = oseRegistry::call('member')->getReceipt($orderInfo);


		$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

		// set document information
		$pdf->SetCreator(PDF_CREATOR);
		$pdf->SetAuthor('OSEMSC');
		$pdf->SetTitle('Invoice #'.$order_id);
		$pdf->SetSubject('Invoice');
		$pdf->SetKeywords('invoice');


		// set default header data
		$pdf->setPrintHeader(false);
		$pdf->setPrintFooter(false);
		//set image scale factor
		$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

		$pdf->SetMargins(30, 18, 30);

		//set some language-dependent strings
		$pdf->setLanguageArray($l);

		$pdf->SetAutoPageBreak(TRUE, 10);
		$pdf->AddPage();

		ob_get_clean();
		//oseExit($receipt->body);
		$css = file_get_contents(JPATH_SITE.DS."components/com_osemsc/assets/css/msc5_invoice.css");
		$receipt->body="<style>".$css."</style>".$receipt->body;

		$pdf->WriteHTML($receipt->body, true, false, true , false , "");
		ob_end_clean();
		$pdf->Output("Invoice-#{$order_id}.pdf", "I");

		oseExit();


    	/*
    	//$receipt = self::orderView();
    	$order_id = JRequest::getInt('order_id');

    	$app = JFactory::getApplication('SITE');
    	//oseExit('dfdf');
    	$app->redirect( JRoute::_('index.php?option=com_osemsc&view=member&format=pdf&memberTask=generateOrderView&order_id='.$order_id));
    	*/
    }
td {
 border: 1px solid black;
text-align: left;

}
</style>
<?php 
echo $table;
$pagepdf = ob_get_contents();
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, 'mm', 'A4', true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('course dedication');
$pdf->SetTitle('course dedication pdf file');
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(4, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
$pdf->setLanguageArray($l);
$pdf->setPrintHeader(false);
$pdf->SetFont('helveticai', '', 7);
$pdf->AddPage();
$pdf->WriteHTML($pagepdf, true, false, false, false, '');
$pdf->lastPage();
ob_end_clean();
$pdf->Output('Dedicationreport.pdf', 'D');
ob_end_flush();
redirect($CFG->wwwroot . 'report/ktreeuserdedicationreport/adminreport.php');
Example #8
0
if ($parvaz2 == null) {
    $en_masir = "masir 1";
    $fa_masir = "مسیر ۱";
    $faghed_etebar_badaz2 = "";
    $ticket = addTicket_print_class::add($ticket_regtime, $customer_name, $ticket_user, $ticket_fname, $ticket_lname, $parvaz_saat, $parvaz_fatarikh, $parvaz_entarikh, $parvaz_shomare, $parvaz_sherkat, $parvaz_mabda, $parvaz_maghsad, $ticket_pic, $ticket_rahgiri, $en_masir, $fa_masir, $bar_mojaz, $bar_mojaz2, $faghed_etebar_ghablaz, $faghed_etebar_ghablaz2, $faghed_etebar_badaz, $faghed_etebar_badaz2, $mabna_nerkh, $mabna_nerkh2, $vazeeat, $vazeeat2, $parvaz_saat2, $parvaz_fatarikh2, $parvaz_entarikh2, $parvaz_shomare2, $void, $cash, $totalfare);
    $ticket .= "<br/>";
    $en_masir = "masir 2";
    $fa_masir = "مسیر ۲";
    $ticket .= addTicket_print_class::add($ticket_regtime, $customer_name, $ticket_user, $ticket_fname, $ticket_lname, $parvaz_saat, $parvaz_fatarikh, $parvaz_entarikh, $parvaz_shomare, $parvaz_sherkat, $parvaz_mabda, $parvaz_maghsad, $ticket_pic, $ticket_rahgiri, $en_masir, $fa_masir, $bar_mojaz, $bar_mojaz2, $faghed_etebar_ghablaz, $faghed_etebar_ghablaz2, $faghed_etebar_badaz, $faghed_etebar_badaz2, $mabna_nerkh, $mabna_nerkh2, $vazeeat, $vazeeat2, $parvaz_saat2, $parvaz_fatarikh2, $parvaz_entarikh2, $parvaz_shomare2, $void, $cash, $totalfare);
    //echo $ticket_masir2;
    $ticket .= "<br/>";
    $en_masir = "PASSENGER COUPON";
    $fa_masir = "کوپن مسافر";
    $ticket .= addTicket_print_class::add($ticket_regtime, $customer_name, $ticket_user, $ticket_fname, $ticket_lname, $parvaz_saat, $parvaz_fatarikh, $parvaz_entarikh, $parvaz_shomare, $parvaz_sherkat, $parvaz_mabda, $parvaz_maghsad, $ticket_pic, $ticket_rahgiri, $en_masir, $fa_masir, $bar_mojaz, $bar_mojaz2, $faghed_etebar_ghablaz, $faghed_etebar_ghablaz2, $faghed_etebar_badaz, $faghed_etebar_badaz2, $mabna_nerkh, $mabna_nerkh2, $vazeeat, $vazeeat2, $parvaz_saat2, $parvaz_fatarikh2, $parvaz_entarikh2, $parvaz_shomare2, $void, $cash, $totalfare);
    //echo $ticket_mosafer;
} else {
    $en_masir = "masir 1";
    $fa_masir = "مسیر ۱";
    $faghed_etebar_badaz2 = "";
    $ticket = addTicket_print_class::add($ticket_regtime, $customer_name, $ticket_user, $ticket_fname, $ticket_lname, $parvaz_saat, $parvaz_fatarikh, $parvaz_entarikh, $parvaz_shomare, $parvaz_sherkat, $parvaz_mabda, $parvaz_maghsad, $ticket_pic, $ticket_rahgiri, $en_masir, $fa_masir, $bar_mojaz, $bar_mojaz2, $faghed_etebar_ghablaz, $faghed_etebar_ghablaz2, $faghed_etebar_badaz, $faghed_etebar_badaz2, $mabna_nerkh, $mabna_nerkh2, $vazeeat, $vazeeat2, $parvaz_saat2, $parvaz_fatarikh2, $parvaz_entarikh2, $parvaz_shomare2, $void, $cash, $totalfare);
    //echo $ticket_masir1;
    $ticket .= "<br/>";
    $en_masir = "PASSENGER COUPON";
    $fa_masir = "کوپن مسافر";
    $ticket .= addTicket_print_class::add($ticket_regtime, $customer_name, $ticket_user, $ticket_fname, $ticket_lname, $parvaz_saat, $parvaz_fatarikh, $parvaz_entarikh, $parvaz_shomare, $parvaz_sherkat, $parvaz_mabda, $parvaz_maghsad, $ticket_pic, $ticket_rahgiri, $en_masir, $fa_masir, $bar_mojaz, $bar_mojaz2, $faghed_etebar_ghablaz, $faghed_etebar_ghablaz2, $faghed_etebar_badaz, $faghed_etebar_badaz2, $mabna_nerkh, $mabna_nerkh2, $vazeeat, $vazeeat2, $parvaz_saat2, $parvaz_fatarikh2, $parvaz_entarikh2, $parvaz_shomare2, $void, $cash, $totalfare);
}
$pdf->WriteHTML($ticket, true, 0, true, 0);
$pdf->Output('example_018.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
Example #9
0
// set some language dependent data:
$lg = array();
$lg['a_meta_charset'] = 'UTF-8';
$lg['a_meta_dir'] = 'rtl';
$lg['a_meta_language'] = 'fa';
$lg['w_page'] = 'page';
// set some language-dependent strings (optional)
$pdf->setLanguageArray($lg);
// ---------------------------------------------------------
// set font
$pdf->SetFont('dejavusans', '', 12);
// add a page
$pdf->AddPage();
// Persian and English content
$htmlpersian = '<span color="#660000">Persian example:</span><br />سلام بالاخره مشکل PDF فارسی به طور کامل حل شد. اینم یک نمونش.<br />مشکل حرف \\"ژ\\" در بعضی کلمات مانند کلمه ویژه نیز بر طرف شد.<br />نگارش حروف لام و الف پشت سر هم نیز تصحیح شد.<br />با تشکر از  "Asuni Nicola" و محمد علی گل کار برای پشتیبانی زبان فارسی.';
$pdf->WriteHTML($htmlpersian, true, 0, true, 0);
// set LTR direction for english translation
$pdf->setRTL(false);
$pdf->SetFontSize(10);
// print newline
$pdf->Ln();
// Persian and English content
$htmlpersiantranslation = '<span color="#0000ff">Hi, At last Problem of Persian PDF Solved completely. This is a example for it.<br />Problem of "jeh" letter in some word like "ویژه" (=special) fix too.<br />The joining of laa and alf letter fix now.<br />Special thanks to "Nicola Asuni" and "Mohamad Ali Golkar" for Persian support.</span>';
$pdf->WriteHTML($htmlpersiantranslation, true, 0, true, 0);
// Restore RTL direction
$pdf->setRTL(true);
// set font
$pdf->SetFont('aefurat', '', 18);
// print newline
$pdf->Ln();
// Arabic and English content
Example #10
0
             }
         }
     }
 }
 // for loop
 if ($uploadfile != '') {
     $_POST['attachment_id'] = substr($uploadfile, 0, -1);
 } else {
     $_POST['attachment_id'] = '';
 }
 $_POST['message_body'] = $_POST['reply_message'];
 $_POST['message_subject'] = "Reply:" . $_POST['reply_subject'];
 $_POST['saved_pdf_file'] = $newsavedPdf . ".pdf";
 $faxId = $faxObjCon->copyFiles($_POST, $_FILES);
 //echo $html1;
 $pdf->WriteHTML($html, false, 0, true, 0);
 $pdf->WriteHTML($html1, false, 0, true, 0);
 $pdf->Output($_SERVER['DOCUMENT_ROOT'] . 'nf/upload_dir/savedpdfs/' . $newsavedPdf . '.pdf', 'F');
 $_POST['saved_pdf_file'] = $newsavedPdf . ".pdf";
 $faxObjCon->sendReply($_POST);
 $faxObjCon->insertToFaxIds($_POST['to_id'], $faxId);
 //echo "<pre>";print_r($_POST); echo "</pre>";
 //echo $to_faxid;
 //echo "<br>";
 //echo $newsavedPdf.'.pdf';
 // Updating the file uploads pdf name
 /*$collectionUp = $db->nf_fax_replys;
 $Update_fax_vals = array("saved_pdf_file" => $newsavedPdf.".pdf");
 $updateRes = $collectionUp->update(array('to_id' => $to_faxid), array('$set' => $Update_fax_vals));*/
 /*if(is_array($finalUserToIds)){              
       for($i=0;$i<count($finalUserToIds);$i++){            
// Restore RTL direction
$pdf->setRTL(true);
// set font
$pdf->SetFont('aealarabiya', '', 18);
// print newline
$pdf->Ln();
$pdf->Cell(0, 12, $contratTitle, 0, 1, 'C');
$pdf->SetFont('aealarabiya', '', 12);
$pdf->Cell(0, 12, $contratReference, 0, 1, 'C');
$pdf->Ln();
$pdf->SetFont('aealarabiya', '', 14);
//$pdf->Ln();
//$htmlcontent = '<strong>'.'الطرف الثاني'.'</strong>';
//$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$htmlcontent = '<strong>' . 'الطرف الأول' . '</strong>' . ' : ' . $company->nomArabe() . '، في شخص ممثلها القانوني, و الكائن مقرها الاجتماعي ' . $company->adresseArabe() . '.';
$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$pdf->Ln();
$htmlcontent = '<strong>' . 'الطرف الثاني' . '</strong>' . ': السيد(ة) ،' . $client->nomArabe() . ' ' . 'المغربي (ة)، الراشد(ة)، ، الحامل (ة)،  لرقم البطاقة الوطنية رقم' . $client->cin() . ' ' . '،  العنوان و الموطن المختار و المحدد هو,' . $client->adresseArabe() . '.';
$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$pdf->SetFont('aealarabiya', '', 18);
$pdf->Cell(0, 12, 'نص الفسخ', 0, 1, 'C');
$pdf->SetFont('aealarabiya', '', 12);
//Contenu du contrat
//Acte 1:
$htmlcontent = '<strong>' . 'البند الأول&nbsp;:&nbsp;' . '</strong>';
$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$htmlcontent = 'يشيد الطرف ان اعاله انيما تراضيا على فسخ العقد الذي يربط بينيما و المتعلق بحفظ حق الطرف الثاني في ملكية شقة و فق البيانات الاتية';
$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$pdf->Ln();
//some details
$htmlcontent = 'تاريخ العقد : ' . date('d/m/Y', strtotime($contrat->dateCreation()));
 public function CustomerOperationsPDF($ID)
 {
     $newday = date('j');
     if (isset($_POST['pdf3']) || $newday == 1) {
         require_once '../tcpdf/config/lang/eng.php';
         require_once '../tcpdf/tcpdf.php';
         // create new PDF document
         $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
         // set default monospaced font
         $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
         //set margins
         $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
         $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
         $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
         //set auto page breaks
         $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
         //set image scale factor
         $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
         // set some language dependent data:
         $lg = array();
         $lg['a_meta_charset'] = 'UTF-8';
         $lg['a_meta_dir'] = 'rtl';
         $lg['a_meta_language'] = 'fa';
         $lg['w_page'] = 'page';
         //set some language-dependent strings
         $pdf->setLanguageArray($lg);
         // ---------------------------------------------------------
         // set font
         $pdf->SetFont('dejavusans', '', 12);
         // add a page
         $pdf->AddPage();
         // Restore RTL direction
         $pdf->setRTL(true);
         // set font
         $pdf->SetFont('aefurat', '', 18);
         // print newline
         $pdf->Ln();
         // Arabic and English content
         $pdf->Cell(0, 12, 'العمليات', 0, 1, 'C');
         $rs = mysql_query("SELECT ID,HospitalID,Date ,Name FROM operation where CustomerID='" . $ID . "' order by Date DESC");
         $html = '';
         $html .= "<table width='100%'><tr>";
         if (mysql_num_rows($rs) > 0) {
             $html .= "<th width='150'>المشفى</th>";
             $html .= "<th width='150'>التاريخ</th>";
             $html .= "<th width='150'>العملية</th>";
             $html .= "</tr>";
             while ($row = mysql_fetch_assoc($rs)) {
                 $hos = mysql_query("SELECT Name FROM hospital where ID='" . $row['HospitalID'] . "'");
                 $hos1 = mysql_fetch_array($hos);
                 $html .= "<tr>";
                 $html .= "<td width='150' align='center'>" . $hos1['Name'] . "</td>";
                 $html .= "<td width='150' align='center'>" . $row['Date'] . "</td>";
                 $html .= "<td width='150' align='center'>" . $row['Name'] . "</td>";
                 $html .= "</tr>";
             }
         } else {
             $html .= "<tr><td colspan='" . ($i + 1) . "'>لا يوجد عملية حتى الآن...</td></tr>";
         }
         $html .= "</table>";
         $pdf->WriteHTML($html, true, 0, true, 0);
         ob_end_clean();
         //$pdf->Output('example_018.pdf', 'I');
         $pdfString = $pdf->Output('dummy.pdf', 'S');
         // $email and $message are the data that is being
         // posted to this page from our html contact form
         $email = "Saed Insurance Corporation";
         $message = "تجد مرفقا العمليات الخاصة بك";
         // When we unzipped PHPMailer, it unzipped to
         // public_html/PHPMailer_5.2.0
         require '../---PHPMailer_5.2.0/class.phpmailer.php';
         $mail = new PHPMailer();
         // set mailer to use SMTP
         $mail->IsSMTP();
         // As this email.php script lives on the same server as our email server
         // we are setting the HOST to localhost
         $mail->SMTPAuth = true;
         // turn on SMTP authentication
         $mail->SMTPSecure = "ssl";
         $mail->Host = "smtp.gmail.com";
         // specify main and backup server
         $mail->Port = 465;
         // When sending email using PHPMailer, you need to send from a valid email address
         // In this case, we setup a test email account with the following credentials:
         // email: send_from_phpmailer@bradm.inmotiontesting.com
         // pass: password
         $mail->Username = "******";
         // SMTP username
         $mail->Password = "******";
         // SMTP password
         // $email is the user's email address the specified
         // on our contact us page. We set this variable at
         // the top of this page with:
         // $email = $_REQUEST['email'] ;
         $mail->From = $email;
         // below we want to set the email address we will be sending our email to.
         $mail->AddAddress("*****@*****.**", "Brad Markle");
         // set word wrap to 50 characters
         $mail->WordWrap = 50;
         // set email format to HTML
         $mail->IsHTML(true);
         $mail->Subject = "You have received feedback from your website!";
         //....................................................
         $mail->AddStringAttachment($pdfString, 'dummy.pdf');
         //..................................................
         // $message is the user's message they typed in
         // on our contact us page. We set this variable at
         // the top of this page with:
         // $message = $_REQUEST['message'] ;
         $mail->Body = $message;
         $mail->AltBody = $message;
         if (!$mail->Send()) {
             echo "Message could not be sent. <p>";
             echo "Mailer Error: " . $mail->ErrorInfo;
             exit;
         }
         header('Location: http://localhost/HW/View/Customers/CustomerOperations.php?ID=' . $ID . '');
     }
 }
Example #13
0
 public static function createPdf($data)
 {
     require_once dirname(__FILE__) . '/_tcpdf_6.0.095/tcpdf_autoconfig.php';
     require_once dirname(__FILE__) . '/_tcpdf_6.0.095/tcpdf.php';
     $pdf = new TCPDF($data->getOrientation() !== null ? $data->getOrientation() : 'P', 'mm', $data->getFormat() !== null ? $data->getFormat() : 'A4');
     $pdf->SetAutoPageBreak(true);
     $pdf->SetTitle($data->getTitle() !== null ? $data->getTitle() : '');
     $pdf->SetSubject($data->getSubject() !== null ? $data->getSubject() : '');
     $pdf->SetAuthor($data->getAuthor() !== null ? $data->getAuthor() : '');
     $pdf->SetCreator($data->getCreator() !== null ? $data->getCreator() : '');
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->AddPage();
     $text = htmlspecialchars_decode($data->getText());
     $pdf->WriteHTML($text);
     // stores the pdf binary data to $result
     $result = $pdf->Output('', 'S');
     return $result;
 }
Example #14
0
 protected function buildPdf()
 {
     /*
      * Setup external configuration options
      */
     define('K_TCPDF_EXTERNAL_CONFIG', true);
     /*
      * Path options
      */
     // Installation path
     define("K_PATH_MAIN", JPATH_LIBRARIES . "/tcpdf");
     // URL path
     define("K_PATH_URL", JPATH_BASE);
     // Fonts path
     define("K_PATH_FONTS", K_PATH_MAIN . '/fonts/');
     // Cache directory path
     define("K_PATH_CACHE", K_PATH_MAIN . "/cache");
     // Cache URL path
     define("K_PATH_URL_CACHE", K_PATH_URL . "/cache");
     // Images path
     define("K_PATH_IMAGES", K_PATH_MAIN . "/images");
     // Blank image path
     define("K_BLANK_IMAGE", K_PATH_IMAGES . "/_blank.png");
     /*
      * Format options
      */
     // Cell height ratio
     define("K_CELL_HEIGHT_RATIO", 1.25);
     // Magnification scale for titles
     define("K_TITLE_MAGNIFICATION", 1.3);
     // Reduction scale for small font
     define("K_SMALL_RATIO", 2 / 3);
     // Magnication scale for head
     define("HEAD_MAGNIFICATION", 1.1);
     /*
      * Create the pdf document
      */
     jimport('tcpdf.tcpdf');
     $pdf = new TCPDF();
     $pdf->SetMargins(15, 27, 15);
     $pdf->SetAutoPageBreak(true, 25);
     $pdf->SetHeaderMargin(5);
     $pdf->SetFooterMargin(10);
     $pdf->setImageScale(4);
     $document = JFactory::getDocument();
     // Set PDF Metadata
     $pdf->SetCreator($document->getGenerator());
     $pdf->SetTitle($document->getTitle());
     $pdf->SetSubject($document->getDescription());
     $pdf->SetKeywords($document->getMetaData('keywords'));
     // Set PDF Header data
     $pdf->setHeaderData('', 0, $document->getTitle(), null);
     // Set RTL
     $lang = JFactory::getLanguage();
     $pdf->setRTL($lang->isRTL());
     // Set Font
     $font = 'freesans';
     $pdf->setHeaderFont(array($font, '', 10));
     $pdf->setFooterFont(array($font, '', 8));
     // Initialize PDF Document
     if (is_callable(array($pdf, 'AliasNbPages'))) {
         $pdf->AliasNbPages();
     }
     $pdf->AddPage();
     $pdf->WriteHTML(ob_get_contents(), true);
     $data = $pdf->Output('', 'S');
     ob_end_clean();
     // Build the PDF Document string from the document buffer
     header('Content-Type: application/pdf; charset=utf-8');
     header('Content-disposition: inline; filename="export.pdf"', true);
     echo $data;
     die;
 }
// add a page
$pdf->AddPage();
// Restore RTL direction
$pdf->setRTL(true);
// set font
$pdf->SetFont('aealarabiya', '', 18);
// print newline
$pdf->Ln();
$pdf->Cell(0, 12, $contratTitle, 0, 1, 'C');
$pdf->Ln();
$pdf->SetFont('aealarabiya', '', 14);
//$pdf->Ln();
//$htmlcontent = '<strong>'.'الطرف الثاني'.'</strong>';
//$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$htmlcontent = '<strong>' . 'الطرف الأول' . '</strong>' . ' : ' . $company->nomArabe() . '، في شخص ممثلها القانوني, و الكائن مقرها الاجتماعي ' . $company->adresseArabe() . '.';
$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$pdf->Ln();
$htmlcontent = '<strong>' . 'الطرف الثاني' . '</strong>' . ': السيد(ة) ،' . $employe->nomArabe() . ' ' . 'المغربي (ة)، الراشد(ة) ، الحامل (ة)،  لرقم البطاقة الوطنية رقم' . $employe->cin() . ' ' . '،  العنوان و الموطن المختار و المحدد هو,' . $employe->adresseArabe() . '.';
$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$pdf->SetFont('aealarabiya', '', 18);
$pdf->Cell(0, 12, 'نص العقد و الاتفاق', 0, 1, 'C');
$pdf->SetFont('aealarabiya', '', 12);
//Contenu du contrat
//Acte 1:
$htmlcontent = '<strong>' . 'البند الأول&nbsp;:&nbsp;' . '</strong>';
$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$htmlcontent = 'يقر الطرفان بأهليتهما للتعاقد و التصرف القانوني طبقا لقواعد حسن النية و التراضي.';
$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
$pdf->Ln();
//Acte 2:
$htmlcontent = '<strong>' . 'البند الثاني&nbsp;:&nbsp;' . '</strong>';
Example #16
0
 public function sendInvoiceMail($order_id)
 {
     require_once JPATH_SITE . '/components/com_redshop/helpers/tcpdf/config' . '/lang/eng.php';
     require_once JPATH_SITE . '/components/com_redshop/helpers/tcpdf/tcpdf.php';
     $redconfig = new Redconfiguration();
     $producthelper = new producthelper();
     $extra_field = new extra_field();
     $config = JFactory::getConfig();
     $message = "";
     $subject = "";
     $cart = '';
     $mailbcc = null;
     $arr_discount_type = array();
     $mailinfo = $this->getMailtemplate(0, "invoice_mail");
     if (count($mailinfo) > 0) {
         $message = $mailinfo[0]->mail_body;
         $subject = $mailinfo[0]->mail_subject;
         if (trim($mailinfo[0]->mail_bcc) != "") {
             $mailbcc = explode(",", $mailinfo[0]->mail_bcc);
         }
     } else {
         return false;
     }
     $row = $this->_order_functions->getOrderDetails($order_id);
     $barcode_code = $row->barcode;
     $arr_discount = explode('@', $row->discount_type);
     $discount_type = '';
     for ($d = 0; $d < count($arr_discount); $d++) {
         if ($arr_discount[$d]) {
             $arr_discount_type = explode(':', $arr_discount[$d]);
             if ($arr_discount_type[0] == 'c') {
                 $discount_type .= JText::_('COM_REDSHOP_COUPON_CODE') . ' : ' . $arr_discount_type[1] . '<br>';
             }
             if ($arr_discount_type[0] == 'v') {
                 $discount_type .= JText::_('COM_REDSHOP_VOUCHER_CODE') . ' : ' . $arr_discount_type[1] . '<br>';
             }
         }
     }
     if (!$discount_type) {
         $discount_type = JText::_('COM_REDSHOP_NO_DISCOUNT_AVAILABLE');
     }
     $search[] = "{discount_type}";
     $replace[] = $discount_type;
     // Set order paymethod name
     $search_sub[] = "{order_id}";
     $replace_sub[] = $row->order_id;
     $search_sub[] = "{order_number}";
     $replace_sub[] = $row->order_number;
     $search_sub[] = "{shopname}";
     $replace_sub[] = SHOP_NAME;
     $message = str_replace($search, $replace, $message);
     $message = $this->imginmail($message);
     $user = JFactory::getUser();
     $billingaddresses = $this->_order_functions->getOrderBillingUserInfo($order_id);
     $email = $billingaddresses->user_email;
     $userfullname = $billingaddresses->firstname . " " . $billingaddresses->lastname;
     $search_sub[] = "{fullname}";
     $replace_sub[] = $userfullname;
     $search_sub[] = "{order_date}";
     $replace_sub[] = $redconfig->convertDateFormat($row->cdate);
     $subject = str_replace($search_sub, $replace_sub, $subject);
     // Set the e-mail parameters
     $from = $config->getValue('mailfrom');
     $fromname = $config->getValue('fromname');
     $message = $this->_carthelper->replaceOrderTemplate($row, $message);
     $message = str_replace("{firstname}", $billingaddresses->firstname, $message);
     $message = str_replace("{lastname}", $billingaddresses->lastname, $message);
     $body = $message;
     $body1 = $message;
     $img_url1 = REDSHOP_FRONT_IMAGES_ABSPATH . "barcode/" . $barcode_code . ".png";
     $img_url = REDSHOP_FRONT_IMAGES_RELPATH . "barcode/" . $barcode_code . ".png";
     // For pdf
     if (function_exists("curl_init")) {
         $bar_codeIMG = '<img src="' . $img_url . '" alt="Barcode"  border="0" />';
         $body = str_replace("{barcode}", $bar_codeIMG, $body);
         // For mail
         $bar_codeIMG1 = '<img src="' . $img_url1 . '" alt="Barcode"  border="0" />';
         $body1 = str_replace("{barcode}", $bar_codeIMG1, $body1);
     }
     $message = $this->_carthelper->replaceOrderTemplate($row, $message);
     ob_clean();
     echo "<div id='redshopcomponent' class='redshop'>";
     $pdfObj = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A5', true, 'UTF-8', false);
     $pdfObj->SetTitle(JText::_('COM_REDSHOP_INVOICE') . $row->order_id);
     $pdfObj->SetAuthor('redSHOP');
     $pdfObj->SetCreator('redSHOP');
     $pdfObj->SetMargins(15, 15, 15);
     $font = 'times';
     $pdfObj->setImageScale(PDF_IMAGE_SCALE_RATIO);
     $pdfObj->setHeaderFont(array($font, '', 10));
     $pdfObj->SetFont($font, "", 12);
     $pdfObj->AddPage();
     $pdfObj->WriteHTML($body, true, false, true, false, '');
     $invoice_pdfName = $row->order_id;
     $pdfObj->Output(JPATH_SITE . '/components/com_redshop/assets/document/invoice/' . $invoice_pdfName . ".pdf", "F");
     $invoice_attachment = JPATH_SITE . '/components/com_redshop/assets/document/invoice/' . $invoice_pdfName . ".pdf";
     if ((INVOICE_MAIL_SEND_OPTION == 2 || INVOICE_MAIL_SEND_OPTION == 3) && $email != "") {
         if (!JUtility::sendMail($from, $fromname, $email, $subject, $body1, 1, null, $mailbcc, $invoice_attachment)) {
             $this->setError(JText::_('COM_REDSHOP_ERROR_SENDING_CONFIRMATION_MAIL'));
             return false;
         }
     }
     if ((INVOICE_MAIL_SEND_OPTION == 1 || INVOICE_MAIL_SEND_OPTION == 3) && ADMINISTRATOR_EMAIL != '') {
         $sendto = explode(",", trim(ADMINISTRATOR_EMAIL));
         if (!JUtility::sendMail($from, $fromname, $sendto, $subject, $body1, 1, null, $mailbcc, $invoice_attachment)) {
             $this->setError(JText::_('COM_REDSHOP_ERROR_SENDING_CONFIRMATION_MAIL'));
             return false;
         }
     }
     return true;
 }
Example #17
0
 function display($tpl = null)
 {
     $config = new Redconfiguration();
     $redTemplate = new Redtemplate();
     $order_functions = new order_functions();
     $model = $this->getModel();
     $detail = $this->get('data');
     $billing = $order_functions->getBillingAddress($detail->user_id);
     $shipping = $order_functions->getOrderShippingUserInfo($detail->order_id);
     if (!$shipping) {
         $shipping = $billing;
     }
     $template = $redTemplate->getTemplate("shipping_pdf");
     $html_template = $template[0]->template_desc;
     ob_start();
     $order_status = $order_functions->getOrderStatusTitle($detail->order_status);
     $html_template = str_replace("{order_information_lbl}", JText::_('COM_REDSHOP_ORDER_INFORMATION'), $html_template);
     $html_template = str_replace("{order_id_lbl}", JText::_('COM_REDSHOP_ORDER_ID'), $html_template);
     $html_template = str_replace("{order_number_lbl}", JText::_('COM_REDSHOP_ORDER_NUMBER'), $html_template);
     $html_template = str_replace("{order_date_lbl}", JText::_('COM_REDSHOP_ORDER_DATE'), $html_template);
     $html_template = str_replace("{order_status_lbl}", JText::_('COM_REDSHOP_ORDER_STATUS'), $html_template);
     $html_template = str_replace("{shipping_address_info_lbl}", JText::_('COM_REDSHOP_SHIPPING_ADDRESS_INFORMATION'), $html_template);
     $html_template = str_replace("{shipping_firstname_lbl}", JText::_('COM_REDSHOP_FIRSTNAME'), $html_template);
     $html_template = str_replace("{shipping_lastname_lbl}", JText::_('COM_REDSHOP_LASTNAME'), $html_template);
     $html_template = str_replace("{shipping_address_lbl}", JText::_('COM_REDSHOP_ADDRESS'), $html_template);
     $html_template = str_replace("{shipping_zip_lbl}", JText::_('COM_REDSHOP_ZIP'), $html_template);
     $html_template = str_replace("{shipping_city_lbl}", JText::_('COM_REDSHOP_CITY'), $html_template);
     $html_template = str_replace("{shipping_country_lbl}", JText::_('COM_REDSHOP_COUNTRY'), $html_template);
     $html_template = str_replace("{shipping_state_lbl}", JText::_('COM_REDSHOP_STATE'), $html_template);
     $html_template = str_replace("{shipping_phone_lbl}", JText::_('COM_REDSHOP_PHONE'), $html_template);
     $html_template = str_replace("{order_id}", $detail->order_id, $html_template);
     $html_template = str_replace("{order_number}", $detail->order_number, $html_template);
     $html_template = str_replace("{order_date}", $config->convertDateFormat($detail->cdate), $html_template);
     $html_template = str_replace("{order_status}", $order_status, $html_template);
     $html_template = str_replace("{shipping_firstname}", $shipping->firstname, $html_template);
     $html_template = str_replace("{shipping_lastname}", $shipping->lastname, $html_template);
     $html_template = str_replace("{shipping_address}", $shipping->address, $html_template);
     $html_template = str_replace("{shipping_zip}", $shipping->zipcode, $html_template);
     $html_template = str_replace("{shipping_city}", $shipping->city, $html_template);
     $html_template = str_replace("{shipping_country}", JTEXT::_($order_functions->getCountryName($shipping->country_code)), $html_template);
     $html_template = str_replace("{shipping_state}", $order_functions->getStateName($shipping->state_code, $shipping->country_code), $html_template);
     $html_template = str_replace("{shipping_phone}", $shipping->zipcode, $html_template);
     // if user is company than
     if ($billing->is_company && $billing->company_name != "") {
         $html_template = str_replace("{company_name}", $billing->company_name, $html_template);
         $html_template = str_replace("{company_name_lbl}", JText::_('COM_REDSHOP_COMPANY_NAME'), $html_template);
     } else {
         $html_template = str_replace("{company_name}", "", $html_template);
         $html_template = str_replace("{company_name_lbl}", "", $html_template);
     }
     $pdfObj = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A5', true, 'UTF-8', false);
     $pdfObj->SetTitle("Order :" . $detail->order_id);
     $pdfObj->SetAuthor('redSHOP');
     $pdfObj->SetCreator('redSHOP');
     $pdfObj->SetMargins(15, 15, 15);
     $font = 'times';
     $pdfObj->SetHeaderData('', '', '', "Order " . $detail->order_id);
     $pdfObj->setHeaderFont(array($font, '', 10));
     //$pdfObj->setFooterFont(array($font, '', 8));
     $pdfObj->SetFont($font, "", 12);
     //$pdfObj->AliasNbPages();
     $pdfObj->AddPage();
     $pdfObj->WriteHTML($html_template);
     $pdfObj->Output("Order_" . $detail->order_id . ".pdf", "D");
     exit;
 }
Example #18
0
 public function updateOrderStatus()
 {
     $session = JFactory::getSession();
     $post = $session->get('updateOrderIdPost');
     $merge_invoice_arr = $session->get('merge_invoice_arr');
     $rand_invoice_name = JRequest::getVar('rand_invoice_name', '');
     $order_functions = new order_functions();
     $cnt = JRequest::getInt('cnt', 0);
     $order_id = $post['cid'];
     $responcemsg = "";
     for ($i = $cnt, $j = 0; $j < 1; $j++) {
         if (!isset($order_id[$i])) {
             $pdf = new PDFMerger();
             $merge_invoice_arr = $session->get('merge_invoice_arr');
             for ($m = 0; $m < count($merge_invoice_arr); $m++) {
                 if (file_exists(JPATH_SITE . '/components/com_redshop/assets/document' . '/invoice/shipped_' . $merge_invoice_arr[$m] . '.pdf')) {
                     $pdf->addPDF(JPATH_SITE . '/components/com_redshop/assets/document' . '/invoice/shipped_' . $merge_invoice_arr[$m] . '.pdf', 'all');
                 }
             }
             $pdf->merge('file', JPATH_SITE . '/components/com_redshop/assets/document' . '/invoice/shipped_' . $rand_invoice_name . '.pdf');
             for ($m = 0; $m < count($merge_invoice_arr); $m++) {
                 if (file_exists(JPATH_SITE . '/components/com_redshop/assets/document' . '/invoice/shipped_' . $merge_invoice_arr[$m] . '.pdf')) {
                     unlink(JPATH_ROOT . '/components/com_redshop/assets/document/invoice/shipped_' . $merge_invoice_arr[$m] . '.pdf');
                 }
             }
             $session->set('merge_invoice_arr', null);
             break;
         }
         $returnmsg = $order_functions->orderStatusUpdate($order_id[$i], $post);
         // For shipped pdf generation
         if ($post['order_status_all'] == "S" && $post['order_paymentstatus' . $order_id[$i]] == "Paid") {
             $pdfObj = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A5', true, 'UTF-8', false);
             $pdfObj->SetTitle('Shipped');
             $pdfObj->SetAuthor('redSHOP');
             $pdfObj->SetCreator('redSHOP');
             $pdfObj->SetMargins(8, 8, 8);
             $font = 'times';
             $pdfObj->setImageScale(PDF_IMAGE_SCALE_RATIO);
             $pdfObj->setHeaderFont(array($font, '', 8));
             $pdfObj->SetFont($font, "", 6);
             $invoice = $order_functions->createShippedInvoicePdf($order_id[$i]);
             $session->set('merge_invoice_arr', $order_id[$i]);
             $pdfObj->AddPage();
             $pdfObj->WriteHTML($invoice, true, false, true, false, '');
             $invoice_pdfName = "shipped_" . $order_id[$i];
             $merge_invoice_arr[] = $order_id[$i];
             $session->set('merge_invoice_arr', $merge_invoice_arr);
             $pdfObj->Output(JPATH_SITE . '/components/com_redshop/assets/document' . '/invoice/' . $invoice_pdfName . ".pdf", "F");
         }
         $responcemsg .= "<div>" . ($i + 1) . ": " . JText::_('COM_REDSHOP_ORDER_ID') . " " . $order_id[$i] . " -> ";
         $errmsg = '';
         if ($returnmsg) {
             $responcemsg .= "<span style='color: #00ff00'>" . JText::_('COM_REDSHOP_ORDER_STATUS_SUCCESSFULLY_UPDATED') . $errmsg . "</span>";
         } else {
             $responcemsg .= "<span style='color: #ff0000'>" . JText::_('COM_REDSHOP_ORDER_STATUS_UPDATE_FAIL') . $errmsg . "</span>";
         }
         $responcemsg .= "</div>";
     }
     $responcemsg = "<div id='sentresponse'>" . $responcemsg . "</div>";
     echo $responcemsg;
     exit;
 }
Example #19
0
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Jim');
$pdf->SetTitle(DEF_CONG);
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData('khlogo.png', 10, DEF_CONG, 'Weekly Schedule', array(0, 0, 0), array(255, 255, 255));
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
    require_once dirname(__FILE__) . '/lang/eng.php';
    $pdf->setLanguageArray($l);
}
$pdf->SetFont('helvetica', '', 11);
$pdf->AddPage();
$pdf->WriteHTML($schedule, true, false, false, false, '');
ob_end_clean();
$pdf->Output('schedule.pdf');
Example #20
0
<?php

//my_assign.php
// A report of upcoming assignments based on user e-mail address / user_id
session_start();
include 'include/functions.inc.php';
$assign =& my_assignments();
require 'tcpdf/tcpdf.php';
$pdf = new TCPDF();
$pdf->AddPage();
$pdf->SetFont('dejavusans', '', 10);
$pdf->WriteHTML($assign);
$pdf->Output('my_assignments.pdf');
Example #21
0
    function display($tpl = null)
    {
        $config = new Redconfiguration();
        $redTemplate = new Redtemplate();
        $order_functions = new order_functions();
        $producthelper = new producthelper();
        $model = $this->getModel();
        $redTemplate = new Redtemplate();
        $detail = $this->get('data');
        $carthelper = new rsCarthelper();
        $shippinghelper = new shipping();
        $products = $order_functions->getOrderItemDetail($detail->order_id);
        $template = $model->getStockNoteTemplate();
        if (count($template) > 0 && $template->template_desc != "") {
            $html_template = $template->template_desc;
        } else {
            $html_template = '<table border="0" cellspacing="2" cellpadding="2" width="100%"><tr><td>{order_id_lbl} : {order_id}</td><td> {order_date_lbl} : {order_date}</td></tr></table>
                       <table border="1" cellspacing="0" cellpadding="0" width="100%"><tbody><tr style="background-color: #d7d7d4"><th align="center">{product_name_lbl}</th> <th align="center">{product_number_lbl}</th> <th align="center">{product_quantity_lbl}</th></tr>
						{product_loop_start}
						<tr>
						<td  align="center">
							<table>
							<tr><td>{product_name}</td></tr>
							<tr><td>{product_attribute}</td></tr>
							</table>
						</td>
						<td  align="center">{product_number}</td>
						<td  align="center">{product_quantity}</td>
						</tr>
						{product_loop_end}
						</tbody>
						</table>';
        }
        ob_start();
        if (strstr($html_template, "{product_loop_start}") && strstr($html_template, "{product_loop_end}")) {
            $template_sdata = explode('{product_loop_start}', $html_template);
            $template_start = $template_sdata[0];
            $template_edata = explode('{product_loop_end}', $template_sdata[1]);
            $template_end = $template_edata[1];
            $template_middle = $template_edata[0];
            $middle_data = '';
            for ($p = 0; $p < count($products); $p++) {
                $middle_data .= $template_middle;
                $product_detail = $producthelper->getProductById($products[$p]->product_id);
                $middle_data = str_replace("{product_number}", $product_detail->product_number, $middle_data);
                $middle_data = str_replace("{product_name}", $products[$p]->order_item_name, $middle_data);
                $middle_data = str_replace("{product_attribute}", $products[$p]->product_attribute, $middle_data);
                $middle_data = str_replace("{product_quantity}", $products[$p]->product_quantity, $middle_data);
            }
            $html_template = $template_start . $middle_data . $template_end;
        }
        $html_template = str_replace("{order_id_lbl}", JText::_('COM_REDSHOP_ORDER_ID'), $html_template);
        $html_template = str_replace("{order_id}", $detail->order_id, $html_template);
        $html_template = str_replace("{order_date_lbl}", JText::_('COM_REDSHOP_ORDER_DATE'), $html_template);
        $html_template = str_replace("{order_date}", $config->convertDateFormat($detail->cdate), $html_template);
        $html_template = str_replace("{product_name_lbl}", JText::_('COM_REDSHOP_PRODUCT_NAME'), $html_template);
        $html_template = str_replace("{product_number_lbl}", JText::_('COM_REDSHOP_PRODUCT_NUMBER'), $html_template);
        $html_template = str_replace("{product_quantity_lbl}", JText::_('COM_REDSHOP_QUANTITY'), $html_template);
        $billing = $order_functions->getOrderBillingUserInfo($detail->order_id);
        $html_template = $carthelper->replaceBillingAddress($html_template, $billing);
        $shipping = $order_functions->getOrderShippingUserInfo($detail->order_id);
        $html_template = $carthelper->replaceShippingAddress($html_template, $shipping);
        $html_template = str_replace("{requisition_number}", $detail->requisition_number, $html_template);
        $html_template = str_replace("{requisition_number_lbl}", JText::_('COM_REDSHOP_REQUISITION_NUMBER'), $html_template);
        // start pdf code
        $pdfObj = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'A5', true, 'UTF-8', false);
        $pdfObj->SetTitle("Order StockNote: " . $detail->order_id);
        $pdfObj->SetAuthor('redSHOP');
        $pdfObj->SetCreator('redSHOP');
        $pdfObj->SetMargins(15, 15, 15);
        $font = 'times';
        $pdfObj->SetHeaderData('', '', '', "Order " . $detail->order_id);
        $pdfObj->setHeaderFont(array($font, '', 10));
        //$pdfObj->setFooterFont(array($font, '', 8));
        $pdfObj->SetFont($font, "", 10);
        //$pdfObj->AliasNbPages();
        $pdfObj->AddPage();
        $pdfObj->WriteHTML($html_template);
        $pdfObj->Output("StocNoteOrder_" . $detail->order_id . ".pdf", "D");
        exit;
    }
Example #22
0
 public function testPdfOutput()
 {
     $this->markTestIncomplete('Ae fonts are not part of this repository.');
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 018');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 018', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language dependent data:
     $lg = array();
     $lg['a_meta_charset'] = 'UTF-8';
     $lg['a_meta_dir'] = 'rtl';
     $lg['a_meta_language'] = 'fa';
     $lg['w_page'] = 'page';
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($lg);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('dejavusans', '', 12);
     // add a page
     $pdf->AddPage();
     // Persian and English content
     $htmlpersian = '<span color="#660000">Persian example:</span><br />سلام بالاخره مشکل PDF فارسی به طور کامل حل شد. اینم یک نمونش.<br />مشکل حرف \\"ژ\\" در بعضی کلمات مانند کلمه ویژه نیز بر طرف شد.<br />نگارش حروف لام و الف پشت سر هم نیز تصحیح شد.<br />با تشکر از  "Asuni Nicola" و محمد علی گل کار برای پشتیبانی زبان فارسی.';
     $pdf->WriteHTML($htmlpersian, true, 0, true, 0);
     // set LTR direction for english translation
     $pdf->setRTL(false);
     $pdf->SetFontSize(10);
     // print newline
     $pdf->Ln();
     // Persian and English content
     $htmlpersiantranslation = '<span color="#0000ff">Hi, At last Problem of Persian PDF Solved completely. This is a example for it.<br />Problem of "jeh" letter in some word like "ویژه" (=special) fix too.<br />The joining of laa and alf letter fix now.<br />Special thanks to "Nicola Asuni" and "Mohamad Ali Golkar" for Persian support.</span>';
     $pdf->WriteHTML($htmlpersiantranslation, true, 0, true, 0);
     // Restore RTL direction
     $pdf->setRTL(true);
     // set font
     $pdf->SetFont('aefurat', '', 18);
     // print newline
     $pdf->Ln();
     // Arabic and English content
     $pdf->Cell(0, 12, 'بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ', 0, 1, 'C');
     $htmlcontent = 'تمَّ بِحمد الله حلّ مشكلة الكتابة باللغة العربية في ملفات الـ<span color="#FF0000">PDF</span> مع دعم الكتابة <span color="#0000FF">من اليمين إلى اليسار</span> و<span color="#009900">الحركَات</span> .<br />تم الحل بواسطة <span color="#993399">صالح المطرفي و Asuni Nicola</span>  . ';
     $pdf->WriteHTML($htmlcontent, true, 0, true, 0);
     // set LTR direction for english translation
     $pdf->setRTL(false);
     // print newline
     $pdf->Ln();
     $pdf->SetFont('aealarabiya', '', 18);
     // Arabic and English content
     $htmlcontent2 = '<span color="#0000ff">This is Arabic "العربية" Example With TCPDF.</span>';
     $pdf->WriteHTML($htmlcontent2, true, 0, true, 0);
     $this->comparePdfs($pdf);
 }
Example #23
0
$pdf->SetTitle($doc_title);
$pdf->SetSubject($doc_subject);
$pdf->SetKeywords($doc_keywords);
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set image scale factor
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$pdf->setLanguageArray($l);
//set language items
//initialize document
$pdf->AliasNbPages();
$pdf->AddPage();
// set barcode
$pdf->SetBarcode(date("Y-m-d H:i:s", time()));
// output some HTML code
$pdf->WriteHTML($htmlcontent, true);
// output some content
$pdf->SetFont("helvetica", "BI", 20);
$pdf->Cell(0, 10, 'TEST Bold-Italic Cell', 1, 0, 'C');
//Close and output PDF document
$pdf->Output();
//============================================================+
// END OF FILE
//============================================================+
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Jim');
$pdf->SetTitle('South Congregation');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(0, 0, 'South Congregation', 'Theocratic Ministry School Worksheet');
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
    require_once dirname(__FILE__) . '/lang/eng.php';
    $pdf->setLanguageArray($l);
}
$pdf->SetFont('helvetica', '', 11);
$pdf->AddPage();
$pdf->WriteHTML($school_worksheet_1, true, false, false, false, '');
$pdf->Output('school_worksheet_1.pdf');