本文整理汇总了PHP中TCPDF::WriteHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::WriteHTML方法的具体用法?PHP TCPDF::WriteHTML怎么用?PHP TCPDF::WriteHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::WriteHTML方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
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;
}
}
示例2: convertHtmlToPdf
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;
}
示例3: printTicket
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();
}
示例4: array
// 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
示例5:
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
//============================================================+
示例6: date
// 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>' . 'البند الأول : ' . '</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()));
示例7: substr
}
}
}
}
// 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++){
示例8: createPdf
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;
}
示例9: CustomerOperationsPDF
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 = "fateh.fateh.12345@gmail.com";
// SMTP username
$mail->Password = "operation123";
// 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("fateh.fateh.12345@gmail.com", "Brad Markle");
// set word wrap to 50 characters
$mail->WordWrap = 50;
// set email format to HTML
//.........这里部分代码省略.........
开发者ID:aalayach,项目名称:Damascsus-University-Team-PHP-insurance-company-project,代码行数:101,代码来源:CustomerView.php
示例10: updateOrderStatus
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;
}
示例11: buildPdf
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;
}
示例12: nv_giapha_export_pdf
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
//.........这里部分代码省略.........
示例13: array
// 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');
示例14: TCPDF
<?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');
示例15: orderViewPDF
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));
*/
}