当前位置: 首页>>代码示例>>PHP>>正文


PHP TCPDF::AliasNbPages方法代码示例

本文整理汇总了PHP中TCPDF::AliasNbPages方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::AliasNbPages方法的具体用法?PHP TCPDF::AliasNbPages怎么用?PHP TCPDF::AliasNbPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TCPDF的用法示例。


在下文中一共展示了TCPDF::AliasNbPages方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
     }
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:81,代码来源:view.pdf.php

示例2: convert

 /**
  * Convert data. Taken from http://www.tecnick.com/pagefiles/tcpdf/example_006.phps
  *
  * @param   string  $data
  * @return  string
  */
 public function convert($data)
 {
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     // SET THESE YOURSELF
     // $pdf->SetAuthor("Nicola Asuni");
     // $pdf->SetTitle("TCPDF Example 006");
     // $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, 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 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);
     //initialize document
     $pdf->AliasNbPages();
     // add a page
     $pdf->AddPage();
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont("dejavusans", "", 10);
     // output the HTML content
     $pdf->writeHTML($data, true, 0, true, 0);
     // return converted html as a string
     return $pdf->Output('', 'S');
 }
开发者ID:justinhernandez,项目名称:convert,代码行数:44,代码来源:Tcpdf.php

示例3: Generate_PDF

/**
 * Generates a pdf file
 *
 * @param string $content	The content to put in the PDF file
 * @param string $doc_title	The title for the PDF file
 * @param string $doc_keywords	The keywords to put in the PDF file
 * @return string Generated output by the pdf (@link TCPDF) class
 */
function Generate_PDF($content, $doc_title, $doc_keywords)
{
    global $icmsConfig;
    require_once ICMS_PDF_LIB_PATH . '/tcpdf.php';
    icms_loadLanguageFile('core', 'pdf');
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
    // set document information
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor(PDF_AUTHOR);
    $pdf->SetTitle($doc_title);
    $pdf->SetSubject($doc_title);
    $pdf->SetKeywords($doc_keywords);
    $sitename = $icmsConfig['sitename'];
    $siteslogan = $icmsConfig['slogan'];
    $pdfheader = icms_core_DataFilter::undoHtmlSpecialChars($sitename . ' - ' . $siteslogan);
    $pdf->SetHeaderData("logo.gif", PDF_HEADER_LOGO_WIDTH, $pdfheader, ICMS_URL);
    //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
    // set font
    $TextFont = @_PDF_LOCAL_FONT && file_exists(ICMS_PDF_LIB_PATH . '/fonts/' . _PDF_LOCAL_FONT . '.php') ? _PDF_LOCAL_FONT : 'dejavusans';
    $pdf->SetFont($TextFont);
    //initialize document
    $pdf->AliasNbPages();
    $pdf->AddPage();
    $pdf->writeHTML($content, true, 0);
    return $pdf->Output();
}
开发者ID:LeeGlendenning,项目名称:formulize,代码行数:45,代码来源:pdf.php

示例4: time

$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
//============================================================+
开发者ID:k7n4n5t3w4rt,项目名称:SeeingSystem,代码行数:31,代码来源:test_old.php

示例5: 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;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:73,代码来源:view.pdf.php

示例6: getSmartyTpl


//.........这里部分代码省略.........
         $pdf->SetCreator(PDF_CREATOR);
         $pdf->SetAuthor(PDF_AUTHOR);
         $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
         $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
         $pdf->setFontSubsetting(false);
         $pdf->AddPage();
         $completion_date = '';
         $resutlt = eF_getTableData('module_workbook_progress', 'completion_date', "users_LOGIN='" . $currentUser->user['login'] . "' and lessons_ID='" . $currentLessonID . "'");
         if ($resutlt) {
             $completion_date = $resutlt[0]['completion_date'];
         }
         $workbookHTML = '';
         $workbookHTML .= '<table>';
         $workbookHTML .= '<tr>';
         $workbookHTML .= '<td colspan="2">';
         $workbookHTML .= formatLogin($currentUser->user['login']);
         $workbookHTML .= '</td>';
         $workbookHTML .= '</tr>';
         $workbookHTML .= '<tr>';
         $workbookHTML .= '<td>';
         $workbookHTML .= $workbookLessonName;
         $workbookHTML .= '</td>';
         $workbookHTML .= '<td>';
         $workbookHTML .= formatTimestamp($completion_date);
         $workbookHTML .= '</td>';
         $workbookHTML .= '</tr>';
         $workbookHTML .= '</table>';
         $pdf->writeHTML($workbookHTML, true, false, true, false, '');
         $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
         $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
         $pdf->setHeaderFont(array('Freeserif', 'I', 11));
         $pdf->setFooterFont(array('Freeserif', '', 8));
         $pdf->setHeaderData('', '', '', $workbookLessonName);
         $pdf->AliasNbPages();
         $pdf->SetFont('Freeserif', '', 10);
         $pdf->SetTextColor(0, 0, 0);
         $pdf->SetFont('Freeserif', '', 10);
         $pdf->SetTextColor(0, 0, 0);
         $workbookAnswers = $this->getWorkbookAnswers($currentUser->user['login'], array_keys($workbookItems));
         $pdf->AddPage();
         $workbookHTML .= '';
         $itemLogo = new EfrontFile(G_DEFAULTIMAGESPATH . "32x32/unit.png");
         $itemLogoUrl = $itemLogo['path'];
         foreach ($workbookItems as $key => $value) {
             $workbookHTML .= '<div id="pdf-block" style="width:98%;float:left;border:1px dotted #808080;page-break-after:always;">';
             $workbookHTML .= '<div style="background-color: #EAEAEA;font-weight: bold;">';
             $workbookHTML .= '<img src="' . $itemLogoUrl . '"/>&nbsp;' . _WORKBOOK_ITEMS_COUNT . $value['position'];
             if ($value['item_title'] != '') {
                 $workbookHTML .= '&nbsp;-&nbsp;' . $value['item_title'];
             }
             $workbookHTML .= '</div>';
             if ($value['item_text'] != '') {
                 $workbookHTML .= '<div>' . $value['item_text'] . '</div>';
             }
             if ($value['item_question'] != '-1') {
                 $questionType = $lessonQuestions[$value['item_question']]['type'];
                 if ($workbookAnswers[$value['id']] == '') {
                     if ($questionType == 'drag_drop') {
                         $dragDrop = eF_getTableData("questions", "options, answer, text", "id=" . $value['item_question']);
                         $options = unserialize($dragDrop[0]['options']);
                         $answer = unserialize($dragDrop[0]['answer']);
                         shuffle($options);
                         shuffle($answer);
                         $workbookHTML .= $dragDrop[0]['text'];
                         for ($i = 0; $i < count($options); $i++) {
                             $workbookHTML .= '<div>' . $options[$i] . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
开发者ID:kaseya-university,项目名称:efront,代码行数:67,代码来源:module_workbook.class.php

示例7: btnPrint_Click

 protected function btnPrint_Click()
 {
     if ($this->lstLabelStock->SelectedValue) {
         $this->lstLabelStock->Warning = "";
         set_time_limit(0);
         // If the user clicked Cancel button
         if ($_SESSION["intGeneratingStatus"] != -1) {
             // If the user clicked outside of the modal dialog
             if ($this->dlgPrintLabels->Visible && $this->dlgPrintLabels->Display) {
                 if ($this->intCurrentBarCodeLabel < count($this->strBarCodeArray)) {
                     array_push($this->strTablesBufferArray, $this->CreateTableByBarCodeArray());
                     $this->txtWarning->Text = "Please wait... PDF Generating: " . $_SESSION["intGeneratingStatus"] . "% Complete";
                     $this->txtWarning->Display = true;
                     $this->btnPrint->Enabled = true;
                     QApplication::ExecuteJavaScript("document.getElementById('" . $this->btnPrint->ControlId . "').click();");
                 } else {
                     include_once '../includes/php/tcpdf/config/lang/eng.php';
                     include_once '../includes/php/tcpdf/tcpdf.php';
                     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
                     // Set document information
                     $pdf->SetCreator("Tracmor");
                     $pdf->SetAuthor("Tracmor");
                     $pdf->SetTitle("Bar Codes");
                     // Set PDF viewer preferences
                     $arrPreferences = array('PrintScaling' => 'None');
                     $pdf->setViewerPreferences($arrPreferences);
                     // Disable header and footer
                     $pdf->setPrintHeader(false);
                     $pdf->setPrintFooter(false);
                     // Disable auto page breaks
                     $pdf->SetAutoPageBreak(false);
                     // Set some language-dependent strings
                     $pdf->setLanguageArray($l);
                     // Set the color used for all drawing operations (lines, rectangles and cell borders).
                     $pdf->SetDrawColor(255);
                     // white
                     // Set Cell Padding
                     $pdf->SetCellPadding(0);
                     // Set Cell Spacing
                     $pdf->SetLineWidth(0);
                     // Initialize document
                     $pdf->AliasNbPages();
                     switch ($this->lstLabelStock->SelectedValue) {
                         case 1:
                             // Labels per row for Avery 6577 (5/8" x 3")
                             $pdf->SetFontSize(3);
                             $pdf->setCellHeightRatio(2.3);
                             // was 1.93
                             // Set margins
                             $pdf->SetMargins(12, 12, 12);
                             break;
                         case 2:
                             // Labels per row for Avery 6576 (1-1/4" x 1-3/4")
                             $pdf->SetFontSize(3);
                             $pdf->setCellHeightRatio(11.0);
                             // was 10.2
                             // Set margins
                             $pdf->SetMargins(10, 16, 10);
                             break;
                         default:
                             throw new QCallerException('Label Stock Not Provided');
                             break;
                     }
                     foreach ($this->strTablesBufferArray as $strTableBuffer) {
                         // add a page
                         $pdf->AddPage();
                         // output the HTML content
                         $pdf->writeHTML($strTableBuffer);
                     }
                     // Close and save PDF document
                     $pdf->Output(".." . __TRACMOR_TMP__ . "/" . $_SESSION['intUserAccountId'] . "_BarCodes.pdf", "F");
                     // Cleaning up
                     $this->btnCancel_Click();
                     // Uncheck all items but SelectAll checkbox
                     foreach ($this->GetAllControls() as $objControl) {
                         if (substr($objControl->ControlId, 0, 11) == 'chkSelected') {
                             $objControl->Checked = false;
                         }
                     }
                     $arrDataGridObjectNameId = $this->ctlSearchMenu->GetDataGridObjectNameId();
                     // Uncheck SelectAll checkbox
                     $this->ctlSearchMenu->{$arrDataGridObjectNameId}[0]->chkSelectAll->Checked = false;
                     // Open generated PDF in new window
                     QApplication::ExecuteJavaScript("window.open('.." . __TRACMOR_TMP__ . "/" . $_SESSION['intUserAccountId'] . "_BarCodes.pdf','Barcodes','resizeable,menubar=1,scrollbar=1,left=0,top=0,width=800,height=600');");
                 }
             } else {
                 // Cleaning up
                 $this->btnCancel_Click();
             }
         }
     } else {
         $this->lstLabelStock->Warning = "Please select one";
         $this->lstLabelStock->Enabled = true;
     }
 }
开发者ID:jdellinger,项目名称:tracmor,代码行数:95,代码来源:labels.php

示例8: _createPDF

 /**
  * Creates a pdf
  * @return none
  */
 private function _createPDF()
 {
     $oTpl = NULL;
     $oTpl = new FrontendTemplate('mod_daily_menu_pdf');
     $iMinDate = 0;
     $iMaxDate = 0;
     $aLocals = array();
     $oLocals = array();
     $sQuery = " SELECT * FROM tl_gastronomy_locals ORDER BY name ASC; ";
     $oLocals = $this->Database->execute($sQuery);
     $aLocals = $oLocals->fetchAllAssoc();
     if (!empty($aLocals)) {
         foreach ($aLocals as $i => $local) {
             // resize the logo
             if (!empty($local['logo'])) {
                 $resizedLogo = NULL;
                 $resizedLogo = $this->getImage($local['logo'], 200, NULL);
                 if ($resizedLogo) {
                     $local['logo'] = $resizedLogo;
                 }
             }
             $aMenus = array();
             $oMenus = array();
             $weekStartingDate = NULL;
             $weekStartingDate = $this->week_to_date(time());
             $sQuery = " SELECT * FROM tl_gastronomy_dailymenus WHERE pid = " . (int) $local['id'] . " AND date >= '" . strtotime($weekStartingDate) . "' AND date < '" . (strtotime($weekStartingDate) + 86400 * $this->dailymenu_num_days) . "' ORDER BY date ASC; ";
             $oMenus = $this->Database->execute($sQuery);
             $aMenus = $oMenus->fetchAllAssoc();
             if (!empty($aMenus)) {
                 foreach ($aMenus as $menu) {
                     if (!$iMinDate || $menu['date'] < $iMinDate) {
                         $iMinDate = $menu['date'];
                     }
                     if (!$iMaxDate || $menu['date'] > $iMaxDate) {
                         $iMaxDate = $menu['date'];
                     }
                 }
             }
             $local['_menus'] = $aMenus;
             $aLocals[$i] = $local;
         }
     }
     $oTpl->minDate = $iMinDate;
     $oTpl->maxDate = $iMaxDate;
     $oTpl->locals = $aLocals;
     $sHTML = $oTpl->parse();
     $sHTML = $this->replaceInsertTags($sHTML);
     // set title
     $pdfTitle = sprintf($GLOBALS['TL_LANG']['tl_gastronomy_dailymenus']['menu_from_till'], date('d.m', $iMinDate), date('d.m', $iMaxDate));
     // Include library
     require_once TL_ROOT . '/system/config/tcpdf.php';
     require_once TL_ROOT . '/plugins/tcpdf/tcpdf.php';
     // Create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
     // Set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor(PDF_AUTHOR);
     $pdf->SetTitle($pdfTitle);
     $pdf->SetSubject($pdfTitle);
     //$pdf->SetKeywords($objArticle->keywords);
     // Prevent font subsetting (huge speed improvement)
     $pdf->setFontSubsetting(false);
     // Remove default header/footer
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // Set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     // 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);
     // Initialize document and add a page
     $pdf->AliasNbPages();
     $pdf->AddPage();
     // Set font
     $pdf->SetFont('helvetica', '', PDF_FONT_SIZE_MAIN);
     // Write the HTML content
     $pdf->writeHTML($sHTML, true, 0, true, 0);
     // Close and output PDF document
     $pdf->lastPage();
     $pdf->Output(standardize(ampersand($pdfTitle, false)) . '.pdf', 'D');
     exit;
 }
开发者ID:numero2,项目名称:contao-gastronomy,代码行数:89,代码来源:ModuleDailyMenu.php

示例9: getHTML

 /**
  * Get HTML (for debugging)
  * @param array params
  * @return string HTML
  */
 function getHTML($answor)
 {
     //extract((array)$params);
     $html = "<table border=0 class='crossTable' align='center'>";
     for ($y = -1; $y < $this->rows; $y++) {
         $html .= "<tr align='center'>";
         for ($x = -1; $x < $this->cols; $x++) {
             if ($x > -1 && $y > -1) {
                 switch ($this->cells[$x][$y]->getCanCrossAxis()) {
                     case PC_AXIS_H:
                         $color = "yellow";
                         break;
                     case PC_AXIS_V:
                         $color = "brown";
                         break;
                     case PC_AXIS_NONE:
                         $color = "red";
                         break;
                     case PC_AXIS_BOTH:
                         $color = "lightgreen";
                         break;
                 }
             }
             $class = isset($this->cells[$x][$y]->letter) ? 'cellLetter' : 'cellEmpty';
             if (!$colors) {
                 $color = "white";
             } else {
                 $class = 'cellDebug';
             }
             $html .= "\n";
             if (isset($this->cells[$x][$y]->number)) {
                 //global $maxinum, $totwords, $wc, $fillflag, $cellflag;
                 $tempinum = $this->cells[$x][$y]->number;
                 //$tempinum = $tempinum + 10 - $maxinum - $wc;
                 //dump($tempinum);
                 //$tempinum = $tempinum + 10 - $this->maxinum - $this->totwords;
                 $html .= "<td class='cellNumber{$cellflag}' align=right valign=bottom><b>{$tempinum}</b></td>";
             } elseif ($y == -1) {
                 $html .= "<td bgcolor='{$color}' class='{$class}{$cellflag}'>&nbsp;</td>";
             } elseif ($x == -1) {
                 $html .= "<td bgcolor='{$color}' class='{$class}{$cellflag}'>&nbsp;</td>";
             } elseif (isset($this->cells[$x][$y]->letter)) {
                 if ($fillflag) {
                     $letter = $this->cells[$x][$y]->letter;
                 } else {
                     $letter = "&nbsp;";
                 }
                 $html .= "<td bgcolor='{$color}' class='{$class}{$cellflag}'>{$letter}</td>";
             } else {
                 $html .= "<td bgcolor='{$color}' class='{$class}{$cellflag}'>&nbsp;</td>";
             }
         }
         $html .= "</tr>";
     }
     $html .= "</table>";
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor(PDF_AUTHOR);
     //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 some language-dependent strings
     $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     $pdf->AliasNbPages();
     // set font
     $pdf->SetFont('FreeSerif', '', 10);
     // add a page
     $pdf->AddPage();
     $ans = 1;
     foreach ($answor[0] as $row1) {
         if ($ans <= 2) {
             $pdf->Cell(100, 10, $row1, 0, 1, L, 0);
         }
         $ans++;
     }
     for ($y = -1; $y < $this->rows; $y++) {
         //$html.= "<tr align='center'>";
         for ($x = -1; $x < $this->cols; $x++) {
             if ($x > -1 && $y > -1) {
                 switch ($this->cells[$x][$y]->getCanCrossAxis()) {
                     case PC_AXIS_H:
                         $color = "yellow";
                         break;
                     case PC_AXIS_V:
                         $color = "brown";
                         break;
                     case PC_AXIS_NONE:
                         $color = "red";
                         break;
                     case PC_AXIS_BOTH:
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:php_crossword_grid.class.php

示例10: getSmartyTpl

 public function getSmartyTpl()
 {
     $currentUser = $this->getCurrentUser();
     $rules = $this->getRules();
     $smarty = $this->getSmartyVar();
     if ($currentUser->getRole($this->getCurrentLesson()) == 'professor' || $currentUser->getRole($this->getCurrentLesson()) == 'student') {
         $currentLesson = $this->getCurrentLesson();
         $currentLessonID = $currentLesson->lesson['id'];
         if (!isset($_SESSION['module_journal_dimension']) || count($_GET) == 2 && $_GET['ctg'] == 'module' && $_GET['op'] == 'module_journal' || count($_GET) == 3 && $_GET['ctg'] == 'module' && $_GET['op'] == 'module_journal' && $_GET['new_lesson_id'] == $currentLessonID) {
             $_SESSION['module_journal_dimension'] = 'small';
         }
         if (!isset($_SESSION['module_journal_entries_from']) || count($_GET) == 2 && $_GET['ctg'] == 'module' && $_GET['op'] == 'module_journal' || count($_GET) == 3 && $_GET['ctg'] == 'module' && $_GET['op'] == 'module_journal' && $_GET['new_lesson_id'] == $currentLessonID) {
             $_SESSION['module_journal_entries_from'] = '-1';
         }
         if (isset($_SESSION['module_journal_scroll_position'])) {
             $smarty->assign("T_JOURNAL_SCROLL_POSITION", $_SESSION['module_journal_scroll_position']);
         }
         $smarty->assign("T_JOURNAL_DIMENSIONS", $_SESSION['module_journal_dimension']);
         $smarty->assign("T_JOURNAL_ENTRIES_FROM", $_SESSION['module_journal_entries_from']);
         $entries = $this->getEntries($currentUser->user['login'], $_SESSION['module_journal_entries_from']);
         global $popup;
         isset($popup) && $popup == 1 ? $popup_ = '&popup=1' : ($popup_ = '');
     }
     $smarty->assign("T_JOURNAL_BASEURL", $this->moduleBaseUrl);
     $smarty->assign("T_JOURNAL_BASELINK", $this->moduleBaseLink);
     if (isset($_GET['edit_allow_export']) && $_GET['edit_allow_export'] == '1' && isset($_GET['allow'])) {
         try {
             $object = eF_getTableData("module_journal_settings", "id", "name='export'");
             eF_updateTableData("module_journal_settings", array("value" => $_GET['allow']), "id=" . $object[0]['id']);
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     }
     if (isset($_GET['edit_professor_preview']) && $_GET['edit_professor_preview'] == '1' && isset($_GET['preview'])) {
         try {
             $object = eF_getTableData("module_journal_settings", "id", "name='preview'");
             eF_updateTableData("module_journal_settings", array("value" => $_GET['preview']), "id=" . $object[0]['id']);
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     }
     if (isset($_GET['dimension']) && eF_checkParameter($_GET['dimension'], 'string')) {
         $smarty->assign("T_JOURNAL_DIMENSIONS", $_GET['dimension']);
         $_SESSION['module_journal_dimension'] = $_GET['dimension'];
     }
     if (isset($_GET['entries_from'])) {
         $smarty->assign("T_JOURNAL_ENTRIES_FROM", $_GET['entries_from']);
         $_SESSION['module_journal_entries_from'] = $_GET['entries_from'];
     }
     if (isset($_GET['delete_rule']) && eF_checkParameter($_GET['delete_rule'], 'id') && in_array($_GET['delete_rule'], array_keys($rules))) {
         try {
             eF_deleteTableData("module_journal_rules", "id=" . $_GET['delete_rule']);
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
         exit;
     }
     if (isset($_GET['deactivate_rule']) && eF_checkParameter($_GET['deactivate_rule'], 'id') && in_array($_GET['deactivate_rule'], array_keys($rules))) {
         eF_updateTableData("module_journal_rules", array('active' => 0), "id=" . $_GET['deactivate_rule']);
     }
     if (isset($_GET['activate_rule']) && eF_checkParameter($_GET['activate_rule'], 'id') && in_array($_GET['activate_rule'], array_keys($rules))) {
         eF_updateTableData("module_journal_rules", array('active' => 1), "id=" . $_GET['activate_rule']);
     }
     if (isset($_GET['delete_entry']) && eF_checkParameter($_GET['delete_entry'], 'id') && in_array($_GET['delete_entry'], array_keys($entries))) {
         $object = eF_getTableData("module_journal_entries", "users_LOGIN", "id=" . $_GET['delete_entry']);
         if ($object[0]['users_LOGIN'] != $_SESSION['s_login']) {
             eF_redirect($this->moduleBaseUrl . "&message=" . urlencode(_JOURNAL_NOACCESS) . $popup_);
             exit;
         }
         eF_deleteTableData("module_journal_entries", "id=" . $_GET['delete_entry']);
     }
     if (isset($_GET['saveas']) && $_GET['saveas'] == 'pdf') {
         $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
         $pdf->SetCreator(PDF_CREATOR);
         $pdf->SetAuthor(PDF_AUTHOR);
         $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
         $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
         $pdf->setFontSubsetting(false);
         $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
         $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
         $pdf->setHeaderFont(array('Freeserif', 'I', 11));
         $pdf->setFooterFont(array('Freeserif', '', 8));
         $pdf->setHeaderData('', '', '', _JOURNAL_NAME);
         $pdf->AliasNbPages();
         $pdf->AddPage();
         $pdf->SetFont('Freeserif', '', 10);
         $pdf->SetTextColor(0, 0, 0);
         foreach ($entries as $entry) {
             $pdf->Cell(0, 0, $entry['entry_date_formatted'], 0, 1, L, 0);
             $pdf->writeHTML('<br/>', true, false, true, false, '');
             $pdf->writeHTML($entry['entry_body'], true, false, true, false, '');
             $pdf->writeHTML('<div style="height: 5px;"></div>', true, false, true, false, '');
             $pdf->writeHTML('<hr>', true, false, true, false, '');
         }
         $fileNamePdf = "journal.pdf";
         header("Content-type: application/pdf");
         header("Content-disposition: attachment; filename=" . $fileNamePdf);
         echo $pdf->Output('', 'S');
//.........这里部分代码省略.........
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:module_journal.class.php

示例11: generatePDF

 /**
  * Generate a PDF from precompiled HTML content
  *
  * @access protected
  * @param array
  * @param string
  * @return string
  */
 protected function generatePDF($strTitle, $strHTML, $blnOutput = true, $pdf = NULL)
 {
     if (!is_object($pdf)) {
         // TCPDF configuration
         $l['a_meta_dir'] = 'ltr';
         $l['a_meta_charset'] = $GLOBALS['TL_CONFIG']['characterSet'];
         $l['a_meta_language'] = $GLOBALS['TL_LANGUAGE'];
         $l['w_page'] = 'page';
         // Include library
         require_once TL_ROOT . '/system/config/tcpdf.php';
         require_once TL_ROOT . '/plugins/tcpdf/tcpdf.php';
         // Create new PDF document
         $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
         // Set document information
         $pdf->SetCreator(PDF_CREATOR);
         $pdf->SetAuthor(PDF_AUTHOR);
         // Remove default header/footer
         $pdf->setPrintHeader(false);
         $pdf->setPrintFooter(false);
         // Set margins
         $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
         // 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);
         // Initialize document and add a page
         $pdf->AliasNbPages();
         // Set font
         $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN);
     }
     // Start new page
     $pdf->AddPage();
     // Write the HTML content
     $pdf->writeHTML($strHTML, true, 0, true, 0);
     if ($blnOutput) {
         // Close and output PDF document
         // @todo $strInvoiceTitle is not defined
         $pdf->lastPage();
         $pdf->Output(standardize(ampersand($strTitle, false), true) . '.pdf', 'D');
         // Stop script execution
         exit;
     }
     return $pdf;
 }
开发者ID:rhymedigital,项目名称:isotope_fedexshipping,代码行数:54,代码来源:FedEx.php

示例12: printArticleAsPdf

 /**
  * Print an article as PDF and stream it to the browser
  * @param object
  */
 protected function printArticleAsPdf(Database_Result $objArticle)
 {
     $objArticle->headline = $objArticle->title;
     $objArticle->printable = false;
     // Generate article
     $objArticle = new ModuleArticle($objArticle);
     $strArticle = $this->replaceInsertTags($objArticle->generate());
     $strArticle = html_entity_decode($strArticle, ENT_QUOTES, $GLOBALS['TL_CONFIG']['characterSet']);
     $strArticle = $this->convertRelativeUrls($strArticle, '', true);
     // Remove form elements and JavaScript links
     $arrSearch = array('@<form.*</form>@Us', '@<a [^>]*href="[^"]*javascript:[^>]+>.*</a>@Us');
     $strArticle = preg_replace($arrSearch, '', $strArticle);
     // HOOK: allow individual PDF routines
     if (isset($GLOBALS['TL_HOOKS']['printArticleAsPdf']) && is_array($GLOBALS['TL_HOOKS']['printArticleAsPdf'])) {
         foreach ($GLOBALS['TL_HOOKS']['printArticleAsPdf'] as $callback) {
             $this->import($callback[0]);
             $this->{$callback}[0]->{$callback}[1]($strArticle, $objArticle);
         }
     }
     // Handle line breaks in preformatted text
     $strArticle = preg_replace_callback('@(<pre.*</pre>)@Us', 'nl2br_callback', $strArticle);
     // Default PDF export using TCPDF
     $arrSearch = array('@<span style="text-decoration: ?underline;?">(.*)</span>@Us', '@(<img[^>]+>)@', '@(<div[^>]+block[^>]+>)@', '@[\\n\\r\\t]+@', '@<br( /)?><div class="mod_article@', '@href="([^"]+)(pdf=[0-9]*(&|&amp;)?)([^"]*)"@');
     $arrReplace = array('<u>$1</u>', '<br>$1', '<br>$1', ' ', '<div class="mod_article', 'href="$1$4"');
     $strArticle = preg_replace($arrSearch, $arrReplace, $strArticle);
     // TCPDF configuration
     $l['a_meta_dir'] = 'ltr';
     $l['a_meta_charset'] = $GLOBALS['TL_CONFIG']['characterSet'];
     $l['a_meta_language'] = $GLOBALS['TL_LANGUAGE'];
     $l['w_page'] = 'page';
     // Include library
     require_once TL_ROOT . '/system/config/tcpdf.php';
     require_once TL_ROOT . '/plugins/tcpdf/tcpdf.php';
     // Create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true);
     // Set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor(PDF_AUTHOR);
     $pdf->SetTitle($objArticle->title);
     $pdf->SetSubject($objArticle->title);
     $pdf->SetKeywords($objArticle->keywords);
     // Prevent font subsetting (huge speed improvement)
     $pdf->setFontSubsetting(false);
     // Remove default header/footer
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // Set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     // 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);
     // Initialize document and add a page
     $pdf->AliasNbPages();
     $pdf->AddPage();
     // Set font
     $pdf->SetFont(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN);
     // Write the HTML content
     $pdf->writeHTML($strArticle, true, 0, true, 0);
     // Close and output PDF document
     $pdf->lastPage();
     $pdf->Output(standardize(ampersand($objArticle->title, false)) . '.pdf', 'D');
     // Stop script execution
     exit;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:71,代码来源:Controller.php

示例13: TCPDF

 function Generate_Content()
 {
     $pdf = new TCPDF();
     //kods ņemts no
     // http://www.tecnick.com/pagefiles/tcpdf/example_001.phps
     // galvene
     $pdf->setHeaderData("", "", "", "Atzīmju izraksts");
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', 12));
     //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);
     //initialize document
     $pdf->AliasNbPages();
     // add a page
     $pdf->AddPage();
     // set font
     $pdf->SetFont("helvetica", "", 10);
     // print a line using Cell()
     $pdf->Cell(50, 12, "Skolēns: {$this->studentName}", 0, 0, 'L');
     $pdf->Ln();
     //ģenerē visu butisko saturu
     for ($i = 0; $i < count($this->grades); $i++) {
         $grade = $this->grades[$i];
         $pdf->Cell(0, 0, sprintf("%s  %s  %s", $grade["date"], $grade["lesson"], $grade["grade"]), 0, 0, 'L');
         $pdf->Ln();
     }
     $this->fileContents = $pdf;
 }
开发者ID:naivists,项目名称:PHPUnit,代码行数:32,代码来源:pdfgradefile.class.php


注:本文中的TCPDF::AliasNbPages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。