• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP TCPDF_FONTS类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了TCPDF_FONTS类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: emarking_import_omr_fonts

/**
 * Imports the OMR fonts
 *
 * @param string $echo
 *            if echoes the result
 */
function emarking_import_omr_fonts($echo = false)
{
    global $CFG;
    // The list of extensions a font in the tcpdf installation has
    $fontfilesextensions = array('.ctg.z', '.php', '.z');
    // The font files required for OMR
    $fonts = array('3of9_new' => '/mod/emarking/lib/omr/3OF9_NEW.TTF', 'omrbubbles' => '/mod/emarking/lib/omr/OMRBubbles.ttf', 'omrextnd' => '/mod/emarking/lib/omr/OMRextnd.ttf');
    // We delete previous fonts if any and then import it
    foreach ($fonts as $fontname => $fontfile) {
        // Deleteing the previous fonts
        foreach ($fontfilesextensions as $extension) {
            $fontfilename = $CFG->libdir . '/tcpdf/fonts/' . $fontname . $extension;
            if (file_exists($fontfilename)) {
                echo "Deleting {$fontfilename}<br/>";
                unlink($fontfilename);
            } else {
                echo "{$fontfilename} does not exist, it must be created<br/>";
            }
        }
        // Import the font
        $ttfontname = TCPDF_FONTS::addTTFfont($CFG->dirroot . $fontfile, 'TrueType', 'ansi', 32);
        // Validate if import went well
        if ($ttfontname !== $fontname) {
            echo "Fatal error importing font {$fontname}<br/>";
            return false;
        } else {
            echo "{$fontname} imported!<br/>";
        }
    }
    return true;
}
开发者ID:eduagdo,项目名称:emarking,代码行数:37,代码来源:locallib.php


示例2: listAction

 public function listAction()
 {
     $receipt = new \FPDI();
     // PDFの余白(上左右)を設定
     $receipt->SetMargins(0, 0, 0);
     // ヘッダーの出力を無効化
     $receipt->setPrintHeader(false);
     // フッターの出力を無効化
     $receipt->setPrintFooter(false);
     // フォントを登録
     $fontPathRegular = $this->getLibPath() . '/tcpdf/fonts/migmix-2p-regular.ttf';
     //         $regularFont = $receipt->addTTFfont($fontPathRegular, '', '', 32);
     $font = new TCPDF_FONTS();
     $regularFont = $font->addTTFfont($fontPathRegular);
     $fontPathBold = $this->getLibPath() . '/tcpdf/fonts/migmix-2p-bold.ttf';
     //         $boldFont = $receipt->addTTFfont($fontPathBold, '', '', 32);
     $font = new TCPDF_FONTS();
     $boldFont = $font->addTTFfont($fontPathBold);
     // ページを追加
     $receipt->AddPage();
     // テンプレートを読み込み
     //         $receipt->setSourceFile($this->getLibPath() . '/tcpdf/tpl/receipt.pdf');
     //         $receipt->setSourceFile($this->getLibPath() . '/tcpdf/tpl/template.pdf');
     //         $receipt->setSourceFile($this->getLibPath() . '/tcpdf/tpl/w01_1.pdf');
     $receipt->setSourceFile($this->getLibPath() . '/tcpdf/tpl/senijiten.pdf');
     // 読み込んだPDFの1ページ目のインデックスを取得
     $tplIdx = $receipt->importPage(1);
     // 読み込んだPDFの1ページ目をテンプレートとして使用
     $receipt->useTemplate($tplIdx, null, null, null, null, true);
     // 書き込む文字列のフォントを指定
     $receipt->SetFont($regularFont, '', 11);
     // 書き込む文字列の文字色を指定
     $receipt->SetTextColor(0, 0, 255);
     // X : 42mm / Y : 108mm の位置に
     $receipt->SetXY(59, 248);
     // 文字列を書き込む
     $receipt->Write(0, isset($_POST['name']) ? $_POST['name'] . 'さん' : '名無しさん');
     /*         $response = new Response(
                 // Output関数の第一引数にはファイル名、第二引数には出力タイプを指定する
                 // 今回は文字列で返してほしいので、ファイル名はnull、出力タイプは S = String を選択する
                 $receipt->Output(null, 'S'),
                 200,
                 array('content-type' => 'application/pdf')
             );
     
             // レスポンスヘッダーにContent-Dispositionをセットし、ファイル名をreceipt.pdfに指定
             $response->headers->set('Content-Disposition', 'attachment; filename="receipt.pdf"');
     
             return $response;
      */
     //         $receipt->
     $receipt->output('newpdf.pdf', 'I');
 }
开发者ID:hira-yahoo,项目名称:tcpdf_examples2,代码行数:53,代码来源:example.php


示例3: getFontList

 /**
  * Get the list of available fonts
  *
  * @return Array of "filename" => "font name"
  **/
 public static function getFontList()
 {
     $list = array();
     $path = TCPDF_FONTS::_getfontpath();
     foreach (glob($path . '/*.php') as $font) {
         unset($name, $type);
         include $font;
         unset($cbbox, $cidinfo, $cw, $dw);
         $font = basename($font, '.php');
         // skip subfonts
         if ((substr($font, -1) == 'b' || substr($font, -1) == 'i') && isset($list[substr($font, 0, -1)])) {
             continue;
         }
         if (substr($font, -2) == 'bi' && isset($list[substr($font, 0, -2)])) {
             continue;
         }
         if (isset($name)) {
             if (isset($type) && $type == 'cidfont0') {
                 // cidfont often have the same name (ArialUnicodeMS)
                 $list[$font] = sprintf(__('%1$s (%2$s)'), $name, $font);
             } else {
                 $list[$font] = $name;
             }
         }
     }
     return $list;
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:32,代码来源:glpipdf.class.php


示例4: installBuiltinFont

 /**
  * @param string $name
  * @return string
  * @see http://www.tcpdf.org/doc/code/classTCPDF__FONTS.html
  */
 public static function installBuiltinFont($name)
 {
     $filename = self::getBuiltinFontPath($name);
     $font_name = \TCPDF_FONTS::addTTFFont($filename, 'TrueTypeUnicode', '', 32);
     static::$installed_builtin_fonts[$name] = $font_name;
     return $font_name;
 }
开发者ID:monnouchi,项目名称:thinreports-php,代码行数:12,代码来源:Font.php


示例5: _afterSave

 /**
  * process uploaded font file and convert to format for use with tcpdf
  *
  * @return void
  */
 protected function _afterSave()
 {
     if ($this->getValue()) {
         TCPDF_FONTS::addTTFfont(Mage::getBaseDir('media') . DS . 'pdf-printouts' . DS . $this->getValue());
         //Alternative if encoding of font can't be determined correctly
         //$pdf->addTTFfont(Mage::getBaseDir('media') . DS . 'pdf-printouts' . DS . $this->getValue(),'TrueType','ansi');
     }
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:13,代码来源:Customfont.php


示例6: run

 public function run($fonts = null)
 {
     if (\Cli::option('help', \Cli::option('h', false)) or empty($fonts)) {
         empty($fonts) and \Cli::error(\Cli::color('No font given.', 'red'));
         return static::help();
     }
     $pdf = new \TCPDF();
     $type = \Cli::option('type', \Cli::option('t', ''));
     $enc = \Cli::option('enc', \Cli::option('e', ''));
     $flags = \Cli::option('flags', \Cli::option('f', 32));
     $outpath = \Cli::option('outpath', \Cli::option('o', K_PATH_FONTS));
     $platid = \Cli::option('platid', \Cli::option('p', 3));
     $encid = \Cli::option('encid', \Cli::option('n', 1));
     $addcbbox = \Cli::option('addcbbox', \Cli::option('b', false));
     $link = \Cli::option('link', \Cli::option('l', false));
     $path = \Cli::option('path', \Cli::option('p'));
     if (!is_null($path) and !\Str::ends_with($path, DS)) {
         $path .= DS;
     }
     $fonts = explode(',', $fonts);
     foreach ($fonts as $font) {
         if (strpos($font, DS) === false and !is_null($path)) {
             $font = $path . $font;
         }
         $fontfile = realpath($font);
         $fontname = \TCPDF_FONTS::addTTFfont($fontfile, $type, $enc, $flags, $outpath, $platid, $encid, $addcbbox, $link);
         if ($fontname == false) {
             $errors = true;
             \Cli::error(\Cli::color($font . ' cannot be added.', 'red'));
         } else {
             \Cli::write(\Cli::color($font . ' added.', 'green'));
         }
     }
     if (!empty($errors)) {
         \Cli::error(\Cli::color('Process finished with errors.', 'red'));
     } else {
         \Cli::write(\Cli::color('Process successfully finished.', 'green'));
     }
 }
开发者ID:indigophp,项目名称:fuel-pdf,代码行数:39,代码来源:tcpdf.php


示例7: init

 function init()
 {
     parent::init();
     $target_dir = DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'www' . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR . 'xepan2' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'xepan' . DIRECTORY_SEPARATOR . 'commerce' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'fonts' . DIRECTORY_SEPARATOR;
     $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
     $uploadOk = 1;
     $fontFileType = pathinfo($target_file, PATHINFO_EXTENSION);
     // Check if image file is a actual image or fake image
     if (isset($_POST["submit"])) {
         $font_format = explode('-', $target_file);
         if (!in_array($font_format[1], array('Regular.ttf', 'Bold.ttf', 'Italic.ttf', 'BoldItalic.ttf'))) {
             $this->api->js(true, $this->js()->reload())->univ()->errorMessage('Wrong Font name ');
             $uploadOk = 0;
             echo $font_format[1];
         }
         if (file_exists($target_file)) {
             $this->api->js(true)->univ()->errorMessage('File Already Exist');
             $uploadOk = 0;
         }
         if ($fontFileType != "ttf") {
             $this->api->js(true)->univ()->errorMessage('Only ttf file is upload');
             $uploadOk = 0;
         }
         if ($uploadOk == 1) {
             if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
                 $this->api->js(true, $this->js()->reload())->univ()->successMessage('Font File ' . basename($_FILES["fileToUpload"]["name"] . " has been uploded"));
                 /*TTF File To Convert & create TCPDF Font file*/
                 $pdf = new \TCPDF('l', 'pt', '', true, 'UTF-8', false);
                 $fontname = \TCPDF_FONTS::addTTFfont($target_file, 'TrueTypeUnicode', '', 32);
                 $pdf->AddFont($fontname, '', 14, '', false);
             } else {
                 $this->app->js(true)->univ()->errorMessage('Sorry, there was an error uploading your file');
             }
         }
     }
 }
开发者ID:xepan,项目名称:commerce,代码行数:36,代码来源:FontUpload.php


示例8: array

$core_fonts = array('courier', 'courierB', 'courierI', 'courierBI', 'helvetica', 'helveticaB', 'helveticaI', 'helveticaBI', 'times', 'timesB', 'timesI', 'timesBI', 'symbol', 'zapfdingbats');
// set fill color
$pdf->SetFillColor(221, 238, 255);
// create one HTML table for each core font
foreach ($core_fonts as $font) {
    // add a page
    $pdf->AddPage();
    // Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
    // set font for title
    $pdf->SetFont('helvetica', 'B', 16);
    // print font name
    $pdf->Cell(0, 10, 'FONT: ' . $font, 1, 1, 'C', true, '', 0, false, 'T', 'M');
    // set font for chars
    $pdf->SetFont($font, '', 16);
    // print each character
    for ($i = 0; $i < 256; ++$i) {
        if ($i > 0 and $i % 16 == 0) {
            $pdf->Ln();
        }
        $pdf->Cell(11.25, 11.25, TCPDF_FONTS::unichr($i), 1, 0, 'C', false, '', 0, false, 'T', 'M');
    }
    $pdf->Ln(20);
    // print a pangram
    $pdf->Cell(0, 0, 'The quick brown fox jumps over the lazy dog', 0, 1, 'C', false, '', 0, false, 'T', 'M');
}
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_055.pdf', 'D');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:mwijsman,项目名称:AlaBonteKoe,代码行数:31,代码来源:example_055.php


示例9: add_font

 public function add_font()
 {
     require_once APPPATH . 'libraries/tcpdf/include/tcpdf_fonts.php';
     require APPPATH . 'libraries/tcpdf/tcpdf.php';
     error_reporting(1);
     $fontMaker = new TCPDF_FONTS();
     $font = $fontMaker->addTTFfont($_SERVER['DOCUMENT_ROOT'] . 'js/TEMPSITC_new.TTF');
     $pdfMaker = new TCPDF('L', 'mm', 'A4', true, 'utf-8');
     $pdfMaker->AddPage('L');
     $pdfMaker->SetMargins(0, 0, 0, true);
     $pdfMaker->SetFont($font);
     $pdfMaker->SetFontSize('20');
     $pdfMaker->SetTextColor(0, 0, 0);
     $pdfMaker->Text(10, 10, 'Hello!');
     echo '<pre>';
     print_r($font);
     echo ':)</pre>';
     //$pdfMaker->Output();
 }
开发者ID:n0rp3d,项目名称:klever,代码行数:19,代码来源:main.php


示例10: getCellCode

 /**
  * Returns the PDF string code to print a cell (rectangular area) with optional borders, background color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text.<br />
  * If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.
  * @param $w (float) Cell width. If 0, the cell extends up to the right margin.
  * @param $h (float) Cell height. Default value: 0.
  * @param $txt (string) String to print. Default value: empty string.
  * @param $border (mixed) Indicates if borders must be drawn around the cell. The value can be a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul> or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
  * @param $ln (int) Indicates where the current position should go after the call. Possible values are:<ul><li>0: to the right (or left for RTL languages)</li><li>1: to the beginning of the next line</li><li>2: below</li></ul>Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: 0.
  * @param $align (string) Allows to center or align the text. Possible values are:<ul><li>L or empty string: left align (default value)</li><li>C: center</li><li>R: right align</li><li>J: justify</li></ul>
  * @param $fill (boolean) Indicates if the cell background must be painted (true) or transparent (false).
  * @param $link (mixed) URL or identifier returned by AddLink().
  * @param $stretch (int) font stretch mode: <ul><li>0 = disabled</li><li>1 = horizontal scaling only if text is larger than cell width</li><li>2 = forced horizontal scaling to fit cell width</li><li>3 = character spacing only if text is larger than cell width</li><li>4 = forced character spacing to fit cell width</li></ul> General font stretching and scaling values will be preserved when possible.
  * @param $ignore_min_height (boolean) if true ignore automatic minimum height value.
  * @param $calign (string) cell vertical alignment relative to the specified Y value. Possible values are:<ul><li>T : cell top</li><li>C : center</li><li>B : cell bottom</li><li>A : font top</li><li>L : font baseline</li><li>D : font bottom</li></ul>
  * @param $valign (string) text vertical alignment inside the cell. Possible values are:<ul><li>T : top</li><li>M : middle</li><li>B : bottom</li></ul>
  * @return string containing cell code
  * @protected
  * @since 1.0
  * @see Cell()
  */
 protected function getCellCode($w, $h = 0, $txt = '', $border = 0, $ln = 0, $align = '', $fill = false, $link = '', $stretch = 0, $ignore_min_height = false, $calign = 'T', $valign = 'M')
 {
     // replace 'NO-BREAK SPACE' (U+00A0) character with a simple space
     $txt = str_replace(TCPDF_FONTS::unichr(160, $this->isunicode), ' ', $txt);
     $prev_cell_margin = $this->cell_margin;
     $prev_cell_padding = $this->cell_padding;
     $txt = TCPDF_STATIC::removeSHY($txt, $this->isunicode);
     $rs = '';
     //string to be returned
     $this->adjustCellPadding($border);
     if (!$ignore_min_height) {
         $min_cell_height = $this->getCellHeight($this->FontSize);
         if ($h < $min_cell_height) {
             $h = $min_cell_height;
         }
     }
     $k = $this->k;
     // check page for no-write regions and adapt page margins if necessary
     list($this->x, $this->y) = $this->checkPageRegions($h, $this->x, $this->y);
     if ($this->rtl) {
         $x = $this->x - $this->cell_margin['R'];
     } else {
         $x = $this->x + $this->cell_margin['L'];
     }
     $y = $this->y + $this->cell_margin['T'];
     $prev_font_stretching = $this->font_stretching;
     $prev_font_spacing = $this->font_spacing;
     // cell vertical alignment
     switch ($calign) {
         case 'A':
             // font top
             switch ($valign) {
                 case 'T':
                     // top
                     $y -= $this->cell_padding['T'];
                     break;
                 case 'B':
                     // bottom
                     $y -= $h - $this->cell_padding['B'] - $this->FontAscent - $this->FontDescent;
                     break;
                 default:
                 case 'C':
                 case 'M':
                     // center
                     $y -= ($h - $this->FontAscent - $this->FontDescent) / 2;
                     break;
             }
             break;
         case 'L':
             // font baseline
             switch ($valign) {
                 case 'T':
                     // top
                     $y -= $this->cell_padding['T'] + $this->FontAscent;
                     break;
                 case 'B':
                     // bottom
                     $y -= $h - $this->cell_padding['B'] - $this->FontDescent;
                     break;
                 default:
                 case 'C':
                 case 'M':
                     // center
                     $y -= ($h + $this->FontAscent - $this->FontDescent) / 2;
                     break;
             }
             break;
         case 'D':
             // font bottom
             switch ($valign) {
                 case 'T':
                     // top
                     $y -= $this->cell_padding['T'] + $this->FontAscent + $this->FontDescent;
                     break;
                 case 'B':
                     // bottom
                     $y -= $h - $this->cell_padding['B'];
                     break;
                 default:
                 case 'C':
//.........这里部分代码省略.........
开发者ID:bochniak,项目名称:lms-1,代码行数:101,代码来源:tcpdf.php


示例11: exportReportAction

 /**
  * Export a PDF report for a project
  *
  * @param \GIB\GradingTool\Domain\Model\Project $project
  */
 public function exportReportAction(\GIB\GradingTool\Domain\Model\Project $project)
 {
     // access check
     $this->checkOwnerOrAdministratorAndDenyIfNeeded($project);
     // The processed submission
     $submission = $this->submissionService->getProcessedSubmission($project);
     if ($submission['hasError']) {
         // Don't export the Grading if is has errors
         $message = new \TYPO3\Flow\Error\Message('The Grading has errors and therefore it cannot be exported. Review and correct the Grading.', \TYPO3\Flow\Error\Message::SEVERITY_ERROR);
         $this->flashMessageContainer->addMessage($message);
         $this->redirect('index', 'Standard');
     }
     // The flat data sheet
     $dataSheet = $this->dataSheetService->getFlatProcessedDataSheet($project);
     $pdf = new \GIB\GradingTool\Utility\TcPdf();
     // set font
     \TCPDF_FONTS::addTTFfont('resource://GIB.GradingTool/Private/Fonts/Cambria.ttf', 'TrueTypeUnicode');
     \TCPDF_FONTS::addTTFfont('resource://GIB.GradingTool/Private/Fonts/Cambria Bold.ttf', 'TrueTypeUnicode');
     \TCPDF_FONTS::addTTFfont('resource://GIB.GradingTool/Private/Fonts/Cambria Italic.ttf', 'TrueTypeUnicode');
     \TCPDF_FONTS::addTTFfont('resource://GIB.GradingTool/Private/Fonts/Cambria Bold Italic.ttf', 'TrueTypeUnicode');
     // set margins
     $pdf->SetMargins(20, 45);
     $pdf->SetHeaderMargin(20);
     $pdf->SetFooterMargin(20);
     $pdf->SetFont('Cambria', '', 10);
     $pdf->SetHeaderFont(array('Cambria', '', 10));
     $pdf->SetFooterFont(array('Cambria', '', 10));
     $pdf->setHtmlVSpace(array('h1' => array(array('h' => 0, 'n' => 0), array('h' => 0, 'n' => 0)), 'h2' => array(array('h' => 0, 'n' => 0), array('h' => 0, 'n' => 0)), 'h3' => array(array('h' => 0, 'n' => 0), array('h' => 1, 'n' => 3)), 'h6' => array(array('h' => 0, 'n' => 0), array('h' => 0, 'n' => 0)), 'p' => array(array('h' => 0, 'n' => 0), array('h' => 1, 'n' => 2.5)), 'ul' => array(array('h' => 0, 'n' => 0), array('h' => 1, 'n' => 2.5))));
     $pdf->setListIndentWidth(3);
     $pdf->SetPrintHeader(TRUE);
     $pdf->SetPrintFooter(TRUE);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Global Infrastructure Basel Foundation');
     $pdf->SetTitle($project->getProjectTitle());
     $pdf->projectTitle = $project->getProjectTitle();
     $pdf->exportDate = strftime('%Y-%m-%d');
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // Must be an Illustrator 3 file
     $epsLogoResource = 'resource://GIB.GradingTool/Private/Images/logo_gib_print.eps';
     // one pixel png
     $onePixelResource = 'resource://GIB.GradingTool/Private/Images/one-pixel.png';
     // partners png
     $gibPartnersResource = 'resource://GIB.GradingTool/Private/Images/gib-partners.png';
     /*** FRONT PAGE ***/
     $pdf->addPage();
     $arguments = array('dataSheet' => $dataSheet, 'project' => $project, 'epsLogoResource' => $epsLogoResource, 'onePixelResource' => $onePixelResource);
     $pdf->writeHTML($this->pdfTemplateRenderer('Front', $arguments), TRUE, FALSE, TRUE);
     /*** PARTNERS PAGE ***/
     $pdf->addPage();
     $arguments = array('gibPartnersResource' => $gibPartnersResource, 'onePixelResource' => $onePixelResource);
     $pdf->writeHTML($this->pdfTemplateRenderer('Partners', $arguments), TRUE, FALSE, TRUE);
     /*** TOC PAGE IS INSERTED AT PAGE 3 ***/
     /*** DATA SHEET FRONT ***/
     $pdf->addPage();
     $pdf->SetAutoPageBreak(FALSE);
     $arguments = array('onePixelResource' => $onePixelResource);
     $pdf->writeHTML($this->pdfTemplateRenderer('DataSheetFront', $arguments), TRUE, FALSE, TRUE);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     /*** DATA SHEET ***/
     $pdf->addPage();
     $arguments = array('dataSheet' => $dataSheet, 'project' => $project, 'onePixelResource' => $onePixelResource);
     $pdf->writeHTML($this->pdfTemplateRenderer('DataSheet', $arguments), TRUE, FALSE, TRUE);
     /*** GRADING FRONT ***/
     $pdf->addPage();
     $pdf->SetAutoPageBreak(FALSE);
     $arguments = array('onePixelResource' => $onePixelResource);
     $pdf->writeHTML($this->pdfTemplateRenderer('GradingFront', $arguments), TRUE, FALSE, TRUE);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     /*** GRADING TOOL ***/
     $pdf->addPage();
     $arguments = array('submission' => $submission, 'project' => $project, 'scoreData' => $this->submissionService->getScoreData(), 'onePixelResource' => $onePixelResource);
     $pdf->writeHTML($this->pdfTemplateRenderer('Grading', $arguments), TRUE, FALSE, TRUE);
     /*** ANALYSIS FRONT ***/
     $pdf->addPage();
     $pdf->SetAutoPageBreak(FALSE);
     $arguments = array('onePixelResource' => $onePixelResource);
     $pdf->writeHTML($this->pdfTemplateRenderer('AnalysisFront', $arguments), TRUE, FALSE, TRUE);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     /*** ANALYSIS ***/
     $pdf->addPage();
     $radarChartFileName = $this->submissionService->getRadarImage($project);
     $lineGraphFileName = $this->submissionService->getLineGraphImage($project);
     $answerLevelGraphFileName = $this->submissionService->getAnswerLevelBarChartImage($project);
     $arguments = array('radarChartFileName' => $radarChartFileName, 'lineGraphFileName' => $lineGraphFileName, 'answerLevelGraphFileName' => $answerLevelGraphFileName, 'onePixelResource' => $onePixelResource, 'submission' => $submission);
     $pdf->writeHTML($this->pdfTemplateRenderer('Analysis', $arguments), TRUE, FALSE, TRUE);
     /** This was the last page */
     $pdf->lastPage();
     /*** TOC PAGE ***/
     $pdf->addTOCPage();
     $arguments = array('dataSheet' => $dataSheet, 'project' => $project, 'onePixelResource' => $onePixelResource);
     $pdf->writeHTML($this->pdfTemplateRenderer('TOCBeforeTOC', $arguments), TRUE, FALSE, TRUE);
//.........这里部分代码省略.........
开发者ID:putheakhem,项目名称:GIB.GradingTool,代码行数:101,代码来源:ProjectController.php


示例12: init

 protected function init()
 {
     //set image scale factor
     $this->setImageScale(PDF_IMAGE_SCALE_RATIO);
     $this->SetDrawColor(125, 165, 65);
     $this->SetFillColor(248, 248, 248);
     $this->SetTextColor(0, 0, 0);
     $this->getAliasNbPages();
     $this->setJPEGQuality(100);
     $this->SetMargins(30, 60, 30);
     if (!empty(\GO::config()->tcpdf_font)) {
         $this->font = \GO::config()->tcpdf_font;
     }
     if (!empty(\GO::config()->tcpdf_ttf_font)) {
         $this->font = \TCPDF_FONTS::addTTFfont(\GO::config()->tcpdf_ttf_font);
         //$this->font=  TCPDF_FONTS::addTTFfont(\GO::config()->tcpdf_ttf_font,'TrueType'); // 2nd parameter is normally autodetected but sometimes this goes wrong.
     }
     if (!empty(\GO::config()->tcpdf_font_size)) {
         $this->font_size = \GO::config()->tcpdf_font_size;
     }
     $this->SetFont($this->font, '', $this->font_size);
     $this->pageWidth = $this->getPageWidth() - $this->lMargin - $this->rMargin;
     $this->SetAutoPageBreak(true, 30);
     // set font
     $this->SetFont($this->font, '', $this->font_size);
 }
开发者ID:ajaboa,项目名称:crmpuan,代码行数:26,代码来源:Pdf.php


示例13: getFontsList

 /**
  * Scans K_PATH_MAIN.'fonts/' folder and moves all files to $this->_getfontpath() folder
  * Added ablity to use TTF fonts (functionality taken from newer version of TCPDF)
  * @uses TCPDF_FONTS::addTTFfont()
  * @uses wp_cache_get()
  * @uses wp_cache_set()
  * @return type
  * @author odokienko@UD
  * @since 1.37.6
  */
 protected function getFontsList()
 {
     $fontlist = wp_cache_get('fontlist', 'wpi_pdf_data');
     if (!empty($fontlist)) {
         $this->fontlist = $fontlist;
         return;
     }
     $uploads_fontsdir_name = $this->_getfontpath();
     if (!is_dir($uploads_fontsdir_name)) {
         @mkdir($uploads_fontsdir_name, 0777, true);
     }
     if (is_dir(K_PATH_MAIN . 'fonts/')) {
         $base_fontsdir = opendir(K_PATH_MAIN . 'fonts/');
         while (($file = readdir($base_fontsdir)) !== false) {
             if ($file == '.' || $file == '..' || file_exists($uploads_fontsdir_name . '/' . $file)) {
                 continue;
             }
             copy(K_PATH_MAIN . 'fonts/' . $file, $uploads_fontsdir_name . '/' . $file);
         }
         closedir($base_fontsdir);
     }
     $uploads_fontsdir = opendir($uploads_fontsdir_name);
     while (($file = readdir($uploads_fontsdir)) !== false) {
         if (strtolower(substr($file, -4)) == '.ttf') {
             include_once 'tcpdf_fonts.php';
             include_once 'tcpdf_static.php';
             $fontname = TCPDF_FONTS::addTTFfont($uploads_fontsdir_name . '/' . $file, '', '', 96, $uploads_fontsdir_name);
             if ($fontname) {
                 array_push($this->fontlist, $fontname);
                 unlink($uploads_fontsdir_name . '/' . $file);
             }
         }
         if (substr($file, -4) == '.php') {
             array_push($this->fontlist, strtolower(basename($file, '.php')));
         }
     }
     wp_cache_add('fontlist', $this->fontlist, 'wpi_pdf_data');
 }
开发者ID:JSpier,项目名称:smacamp,代码行数:48,代码来源:wpi_tcpdf.php


示例14: getPdfFile

/**
 * [getPdfFile generate and save PDF file]
 * @param  int $idSpec
 * @return str or false
 */
function getPdfFile($idSpec)
{
    $arSpecification = getSpecification($idSpec);
    if ($arSpecification) {
        $allSumSpec = "";
        foreach ($arSpecification["ITEMS"] as $key => $arItems) {
            $allSumSpec += $arItems["DISCOUNT"]["PRICE"] * $arItems["PROPERTY_COUNT_VALUE"];
            $totalPrice += $arItems["DISCOUNT"]["DISCOUNT_PRICE"] * $arItems["PROPERTY_COUNT_VALUE"];
            $allDisSpec += $arItems["DISCOUNT"]["PRICE"] - $arItems["DISCOUNT"]["DISCOUNT_PRICE"];
            $allSumminDisSpec += $arItems["DISCOUNT"]["DISCOUNT_PRICE"] * $arItems["PROPERTY_COUNT_VALUE"];
        }
        include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/php_interface/include/tcpdf/tcpdf.php";
        $curDate = date("d.m.Y H:i:s");
        global $USER;
        $name = $USER->GetFirstName() . "_" . $USER->GetLastName() . "_" . str_replace(" ", "_", $arSpecification["NAME"]) . "_" . $curDate;
        $nameFile = CUtil::translit($name, "ru", translitParams());
        // create new PDF document
        $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
        $fontname = TCPDF_FONTS::addTTFfont($_SERVER["DOCUMENT_ROOT"] . "/bitrix/php_interface/include/tcpdf/font_arial/arial.ttf", '', '', 32);
        // set document information
        $pdf->SetAuthor($USER->GetFirstName() . " " . $USER->GetLastName());
        $pdf->SetTitle("Спецификация " . $arSpecification["NAME"]);
        // set font
        $pdf->SetFont($fontname, 'BI', 12);
        // add a page
        $pdf->AddPage();
        $text = "Спецификация: №" . $arSpecification["ID"];
        $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
        $text = "Дизайнер: " . $USER->GetFirstName() . " " . $USER->GetLastName();
        $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
        $text = "Название спецификации: " . $arSpecification["NAME"];
        $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
        $text = "Стоимость товаров: " . number_format($allSumSpec, 0, 0, " ") . " руб.";
        $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
        $text = "Со скидкой: " . number_format($allSumminDisSpec, 0, 0, " ") . " руб.";
        $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
        $text = "Экономия: " . number_format($allDisSpec, 0, 0, " ") . " руб.";
        $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
        $text = "ИТОГО: " . number_format($totalPrice, 0, 0, " ") . " руб.";
        $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
        $text = "Продукты:";
        $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
        foreach ($arSpecification["ITEMS"] as $key => $arItems) {
            $text = $key + 1 . ". Артикул: " . $arItems["PRODUCT"]["PROPERTY_ARTIKUL_VALUE"];
            $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
            $text = "    Идентификатор продукта: " . $arItems["PRODUCT"]["ID"];
            $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
            $text = "    Название: " . $arItems["PRODUCT"]["NAME"];
            $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
            $text = "    Цена: " . number_format($arItems["DISCOUNT"]["DISCOUNT_PRICE"], 0, 0, " ") . " руб.";
            $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
            $text = "    Количество: " . $arItems["PROPERTY_COUNT_VALUE"];
            $pdf->Write(0, $text, '', 0, 'L', true, 0, false, false, 0);
        }
        $filePath = $_SERVER["DOCUMENT_ROOT"] . "/upload/spec_files/" . $nameFile . ".pdf";
        $path = "/upload/spec_files/" . $nameFile . ".pdf";
        //Close and save PDF document
        $pdf->Output($filePath, 'F');
        return $path;
    }
    return false;
}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:67,代码来源:specifications.php


示例15: save_design

 public function save_design()
 {
     if ($this->input->post('mode') == 'edit') {
         $this->db->delete('designs', array('id' => $this->input->post('design_id')));
     }
     $faceMacket = str_replace('http://klever.media/', '', $this->input->post('faceMacket'));
     $backMacket = str_replace('http://klever.media/', '', $this->input->post('backMacket'));
     $face = $this->input->post('face');
     $back = $this->input->post('back');
     // get all fonts
     $query = $this->db->get('fonts');
     $fonts = array();
     foreach ($query->result() as $font) {
         $fonts[$font->family] = $font->source;
     }
     // generate pdf face template name and preview name
     $face_pdf = 'uploads/redactor/face_' . md5(microtime(true)) . '.pdf';
     $face_preview = 'uploads/redactor/face_' . md5(microtime(true)) . '.jpg';
     // convert face image to pdf
     $img = new Imagick($faceMacket);
     $img->setresolution(300, 300);
     $img->setcolorspace(Imagick::COLORSPACE_CMYK);
     $img->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
     $img->setimageformat('pdf');
     $img->writeimage($face_pdf);
     // include TCPDF ana FPDI
     include_once APPPATH . 'libraries/tcpdf/tcpdf.php';
     include_once APPPATH . 'libraries/tcpdf/fpdi.php';
     include_once APPPATH . 'libraries/tcpdf/include/tcpdf_fonts.php';
     $fontMaker = new TCPDF_FONTS();
     // создаём лист
     $pdf = new FPDI('L', 'mm', array(91, 61), true, 'UTF-8', false);
     $pdf->SetMargins(0, 0, 0, true);
     $pdf->AddPage('L');
     // загрузим ранее сохранённый шаблон
     $pdf->setSourceFile($face_pdf);
     $pdf->SetMargins(0, 0, 0, true);
     $tplIdx = $pdf->importPage(1);
     $pdf->useTemplate($tplIdx, null, null, 0, 0, true);
     // установим опции для pdf
     $pdf->setCellHeightRatio(1);
     $pdf->setCellPaddings(0, 0, 0, 0);
     $pdf->setCellMargins(0, 0, 0, 0);
     $pdf->SetAutoPageBreak(false, 0);
     $pdf->SetPrintHeader(false);
     $pdf->SetPrintFooter(false);
     if (!empty($face)) {
         // отрисуем сначала изображения лица
         foreach ($face as $item) {
             if ($item['type'] == 'image') {
                 $pdf->Image($_SERVER['DOCUMENT_ROOT'] . '/' . str_replace('http://klever.media/', '', $item['content']), $this->px_to_mm($item['left']), $this->px_to_mm($item['top']), $this->px_to_mm($item['width']), '', '', '', '', false, 300);
             }
         }
         // потом текст на лице
         foreach ($face as $item) {
             if ($item['type'] == 'text') {
                 $cmyk = $this->rgbToCmyk($item['color']);
                 $pdf->SetTextColor($cmyk['c'] * 100, $cmyk['m'] * 100, $cmyk['y'] * 100, $cmyk['k'] * 100);
                 // set font
                 $tcpdfFont = $fontMaker->addTTFfont(realpath('fonts/redactor/' . $fonts[$item['font']]));
                 $pdf->SetFont($tcpdfFont, '', $item['size'] / 2, '', 'false');
                 $pdf->Text($this->px_to_mm($item['left']), $this->px_to_mm($item['top']), $item['content'], false, false, true, 0, 0, 'L', false, '', 0, false, 'T', 'L', false);
             }
         }
     }
     // сохраним пдф лица
     $pdf->Output($_SERVER['DOCUMENT_ROOT'] . '/' . $face_pdf, 'F');
     // сделаем превью для пользователя
     $im = new Imagick();
     $im->setResolution(300, 300);
     $im->readimage($face_pdf . '[0]');
     $im->flattenimages();
     $im->setImageFormat('jpg');
     $im->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
     $im->writeImage($face_preview);
     $im->clear();
     $im->destroy();
     //exec('$ convert ' . $_SERVER['DOCUMENT_ROOT'] . '/' . $face_pdf . ' ' . $_SERVER['DOCUMENT_ROOT'] . '/' . $face_preview);
     // есть ли оборот
     if (!empty($backMacket)) {
         // generate pdf back template name and preview name
         $back_pdf = 'uploads/redactor/back_' . md5(microtime(true)) . '.pdf';
         $back_preview = 'uploads/redactor/back_' . md5(microtime(true)) . '.jpg';
         // convert back image to pdf
         $img = new Imagick($backMacket);
         $img->setresolution(300, 300);
         $img->setcolorspace(Imagick::COLORSPACE_CMYK);
         $img->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
         $img->setimageformat('pdf');
         $img->writeimage($back_pdf);
         // создаём лист
         $pdf = new FPDI('L', 'mm', array(91, 61), true, 'UTF-8', false);
         $pdf->AddPage('L');
         // загрузим ранее сохранённый шаблон
         $pdf->setSourceFile($_SERVER['DOCUMENT_ROOT'] . '/' . $back_pdf);
         $pdf->SetMargins(0, 0, 0, true);
         $tplIdx = $pdf->importPage(1);
         $pdf->useTemplate($tplIdx, null, null, 0, 0, true);
         // установим опции для pdf
         $pdf->SetMargins(0, 0, 0, true);
//.........这里部分代码省略.........
开发者ID:n0rp3d,项目名称:klever,代码行数:101,代码来源:admin.php


示例16: SetAlias

 /**
  * Function to set alias which will be expanded on page rendering.
  *
  * @param string $name  name of the alias
  * @param string $value value of the alias
  *
  * @return void
  */
 function SetAlias($name, $value)
 {
     $name = TCPDF_FONTS::UTF8ToUTF16BE($name, false, true, $this->CurrentFont);
     $this->Alias[$name] = TCPDF_FONTS::UTF8ToUTF16BE($value, false, true, $this->CurrentFont);
 }
开发者ID:yszar,项目名称:linuxwp,代码行数:13,代码来源:PDF.class.php


示例17: hyphenateText

 /**
  * Returns text with soft hyphens.
  * @param $text (string) text to process
  * @param $patterns (mixed) Array of hypenation patterns or a TEX file containing hypenation patterns. TEX patterns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/
  * @param $dictionary (array) Array of words to be returned without applying the hyphenation algoritm.
  * @param $leftmin (int) Minimum number of character to leave on the left of the word without applying the hyphens.
  * @param $rightmin (int) Minimum number of character to leave on the right of the word without applying the hyphens.
  * @param $charmin (int) Minimum word length to apply the hyphenation algoritm.
  * @param $charmax (int) Maximum length of broken piece of word.
  * @return array text with soft hyphens
  * @author Nicola Asuni
  * @since 4.9.012 (2010-04-12)
  * @public
  */
 public function hyphenateText($text, $patterns, $dictionary = array(), $leftmin = 1, $rightmin = 2, $charmin = 1, $charmax = 8)
 {
     $text = $this->unhtmlentities($text);
     $word = array();
     // last word
     $txtarr = array();
     // text to be returned
     $intag = false;
     // true if we are inside an HTML tag
     if (!is_array($patterns)) {
         $patterns = TCPDF_STATIC::getHyphenPatternsFromTEX($patterns);
     }
     // get array of characters
     $unichars = TCPDF_FONTS::UTF8StringToArray($text, $this->isunicode, $this->CurrentFont);
     // for each char
     foreach ($unichars as $char) {
         if (!$intag and TCPDF_FONT_DATA::$uni_type[$char] == 'L') {
             // letter character
             $word[] = $char;
         } else {
             // other type of character
             if (!TCPDF_STATIC::empty_string($word)) {
                 // hypenate the word
                 $txtarr = array_merge($txtarr, $this->hyphenateWord($word, $patterns, $dictionary, $leftmin, $rightmin, $charmin, $charmax));
                 $word = array();
             }
             $txtarr[] = $cha 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TCPDF_IMAGES类代码示例发布时间:2022-05-23
下一篇:
PHP TCPDF_COLORS类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap