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


PHP TCPDF::Output方法代码示例

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


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

示例1: PdfAction

 public function PdfAction()
 {
     $pdf = new TCPDF('L');
     $pdf->SetPrintHeader(true);
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $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);
     }
     // set font
     $pdf->SetFont('helvetica', '', 8);
     // add a page
     $pdf->AddPage();
     //get report data into $data variable
     $project = $this->getServiceLocator()->get('ProjectTable');
     $data = $project->getWsr();
     $view = new PhpRenderer();
     $resolver = new TemplateMapResolver();
     //set the path of the pdf.phtml file
     $resolver->setMap(array('PDFTemplate' => '/var/www/html/WSRAutomation/module/Application/view/application/index/pdf.phtml'));
     $view->setResolver($resolver);
     $viewModel = new ViewModel();
     $viewModel->setTemplate('PDFTemplate')->setVariables(array('projects' => $data, 'view' => 'pdf'));
     $html = $view->render($viewModel);
     $pdf->writeHTML($html, true, 0, true, 0);
     $pdf->Output('WsrReport.pdf', 'I');
 }
开发者ID:vikas1monu,项目名称:ProductionWsr,代码行数:35,代码来源:IndexController.php

示例2: output

 /**
  * Generates Pdf from html
  *
  * @return string raw pdf data
  */
 public function output()
 {
     //TCPDF often produces a whole bunch of errors, although there is a pdf created when debug = 0
     //Configure::write('debug', 0);
     $TCPDF = new \TCPDF($this->_Pdf->orientation(), 'mm', $this->_Pdf->pageSize());
     $TCPDF->AddPage();
     $TCPDF->writeHTML($this->_Pdf->html());
     return $TCPDF->Output('', 'S');
 }
开发者ID:ceeram,项目名称:cakepdf,代码行数:14,代码来源:TcpdfEngine.php

示例3: output

 /**
  * Returns the PDF as a string
  *
  * @param array  $options associative array: 'compress' => 1 or 0
  * @return string
  */
 function output($options = null)
 {
     dompdf_debug("trace", "({$options['compress']})");
     // Add page text
     $this->_add_page_text();
     $this->_add_internal_links();
     $this->_place_objects();
     if (isset($options["compress"]) && $options["compress"] == 0) {
         $compress = false;
     } else {
         $compress = true;
     }
     $this->_pdf->SetCompression($compress);
     return $this->_pdf->Output('', 'S');
 }
开发者ID:Razinsky,项目名称:echaude-com,代码行数:21,代码来源:tcpdf_adapter.cls.php

示例4: prepareNationalSummaryReport

function prepareNationalSummaryReport($conn)
{
    $MonthList = array('1' => 'January', '2' => 'February', '3' => 'March', '4' => 'April', '5' => 'May', '6' => 'June', '7' => 'July', '8' => 'August', '9' => 'September', '10' => 'October', '11' => 'November', '12' => 'December');
    require_once 'tcpdf/tcpdf.php';
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    $pdf->SetPrintHeader(false);
    $pdf->SetPrintFooter(false);
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
        require_once dirname(__FILE__) . '/lang/eng.php';
        $pdf->setLanguageArray($l);
    }
    $pdf->SetFont('dejavusans', '', 10);
    $pdf->AddPage();
    ini_set('magic_quotes_gpc', 'off');
    $html = htmlentities($_POST['html'], ENT_QUOTES, "UTF-8");
    $html = html_entity_decode($html, ENT_QUOTES, "UTF-8");
    $alavel = htmlentities($_POST['alavel'], ENT_QUOTES, "UTF-8");
    $alavel = html_entity_decode($alavel, ENT_QUOTES, "UTF-8");
    $filePath = SITEDOCUMENT . 'administrator/components/com_jcode/source/report/pdfslice/national_summary.svg';
    if (file_exists($filePath)) {
        unlink($filePath);
    }
    $file = fopen($filePath, "w");
    fwrite($file, $html);
    fclose($file);
    $pdf->ImageSVG($file = 'pdfslice/national_summary.svg', $x = 20, $y = 20, $w = 180, $h = 100, $link = '', $align = '', $palign = 'center', $border = 0, $fitonpage = false);
    $html2 = <<<EOF
    <!-- EXAMPLE OF CSS STYLE -->
    <style>
    </style>
    <body>
        <div id="barchartlegend">
            {$alavel}
        </div>
    </body>
EOF;
    echo $html2;
    $pdf->writeHTMLCell($w = 150, $h = 30, $x = 15, $y = 130, $html2, $border = 0, $ln = 0, $fill = false, $reseth = true, $align = 'middle', $autopadding = true);
    $filePath = SITEDOCUMENT . 'administrator/components/com_jcode/source/report/pdfslice/NationalSummaryChart.pdf';
    if (file_exists($filePath)) {
        unlink($filePath);
    }
    $pdf->Output('pdfslice/NationalSummaryChart.pdf', 'F');
}
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:50,代码来源:r_report_national_summary_pdf.php

示例5: loadPdf

    function loadPdf($article_id)
    {
        $this->load->library('pdf');
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        // Add a page
        $pdf->AddPage();
        // $html = '<div class="col-lg-12"> <h1 class="page-header">News</h1></div>';
        //$data['article'] = $this->articles->get_article($article_id);
        //$html= $this->load->view('output_pdf', $data);
        $data = $this->articles->get_article($article_id);
        $html = '<body style="height: 100%;margin-bottom: 30px;"><div style="height: 30px;">News<br/>Title:' . $data['title'] . '</div><div id="content"><center><img src="./././images/' . $data['photo'] . '"' . 'width="100" height="150" align="center"></center><br/>' . $data['text'] . '[</div><div style="height: 30px;position: absolute;
		    bottom: 0;">[Author Name]:' . $data['user_name'] . '- [TimeStamp]:' . $data['curr_time'] . '</div>';
        $pdf->writeHTML($html, true, false, true, false, '');
        ob_clean();
        $pdf->Output('news_001.pdf', 'I');
    }
开发者ID:jawad2007,项目名称:news_portal,代码行数:16,代码来源:pdfexample.php

示例6: class_report_pdf

 public function class_report_pdf()
 {
     $class_date = date('Y-m-d');
     if ($this->input->get('class_date') != "") {
         $class_date = $this->input->get('class_date');
     }
     if ($this->input->post('class_date') != "") {
         $class_date = $this->input->post('class_date');
     }
     $this->load->model('class_report_model');
     $this->load->model('check_in_model');
     $check_ins = $this->class_report_model->check_ins_get($class_date);
     $totals = $this->class_report_model->class_report_totals($class_date);
     $incident_report = $this->class_report_model->incident_report_get($class_date);
     $teacher_check_ins = $this->check_in_model->check_ins_teachers_get($class_date);
     $classes = $this->check_in_model->classes_get();
     // $data['main_content'] = 'class_report_view';
     // $html = $this->load->view('reports/class_report_view', $data);
     require 'application/views/reports/class_report_view.php';
     // $html = '<style>'.file_get_contents('./css/bootstrap.min.css').'</style>';
     // exit($html);
     // $html = '<h1>Class Report</h1>';
     $this->load->library('pdf');
     // create new PDF document
     $pdf = new TCPDF("P", PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Solid Rock');
     $pdf->SetTitle('Class Report');
     $pdf->SetSubject('Class Report');
     $pdf->SetKeywords('Solid Rock, Kidz Rock');
     //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);
     // add a page
     $pdf->AddPage();
     // create some HTML content
     // $html = '<h1>Class Report</h1>';
     // output the HTML content
     $pdf->writeHTML($html, true, false, true, false, '');
     //Close and output PDF document
     $pdf->Output('class_report.pdf', 'I');
 }
开发者ID:nradford,项目名称:contact_attendance,代码行数:46,代码来源:reports.php

示例7: renderRfqRequest

 /**
  * Render a PDF file and show in browser or save to disk
  * If save to disk return file location
  */
 public function renderRfqRequest($quote, $saveToDisk = false)
 {
     $storeid = $quote->getStoreId();
     if ($storeid) {
         $appEmulation = Mage::getSingleton('core/app_emulation');
         $initial = $appEmulation->startEnvironmentEmulation($storeid, Mage_Core_Model_App_Area::AREA_FRONTEND, true);
     }
     $pdf = new TCPDF();
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->AddPage();
     $pdf->SetAutoPageBreak(true, 30);
     $pdf->setHeaderMargin(20);
     $pdf->setFooterMargin(20);
     $pdf->setImageScale(1.5);
     $emailtext = Mage::helper('request4quote/email')->sendRequestProposalNotification($quote, false, true);
     $pdf->writeHTML(Mage::helper('cms')->getBlockTemplateProcessor()->filter($emailtext), false);
     $pdf->endPage();
     if ($storeid) {
         $appEmulation->stopEnvironmentEmulation($initial);
     }
     $rfqfilename = 'rfq_' . $quote->getId() . '.pdf';
     if (!$saveToDisk) {
         return $pdf->Output($rfqfilename);
     } else {
         if ($saveToDisk) {
             $filePath = $this->getFilePath() . $rfqfilename;
             $pdf->Output($filePath, 'F');
             return $filePath;
         }
     }
     exit;
 }
开发者ID:VinuWebtech,项目名称:production267,代码行数:37,代码来源:Quotepdf.php

示例8: run

 public function run()
 {
     include getcwd() . '/vendor/autoload.php';
     $navStructure = (include getcwd() . '/docs/navigation.php');
     echo "Loading markdown...\n";
     $markdown = $this->findMarkdown($navStructure);
     echo "Converting markdown to html...\n";
     $Parsedown = new \Parsedown();
     $html = $Parsedown->text($markdown);
     $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     #$pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('My Documentation');
     #$pdf->SetSubject('TCPDF Tutorial');
     #$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetFont('helvetica', '', 20);
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->AddPage();
     $pdf->writeHTML($html, true, 0, true, 0);
     $pdf->lastPage();
     echo "Writing PDF...\n";
     $pdf->Output($this->config['output'], 'F');
     echo "Complete.\n";
 }
开发者ID:dev-lucid,项目名称:lucid,代码行数:27,代码来源:BuildDocs.php

示例9: create_pdf

function create_pdf($content, $title)
{
    tcpdf();
    $obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    $obj_pdf->SetCreator(PDF_CREATOR);
    $title = $title;
    $obj_pdf->SetTitle('MultiTV analytics');
    $obj_pdf->SetAuthor('MultiTv');
    $obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
    $obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
    $obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
    $obj_pdf->SetDefaultMonospacedFont('helvetica');
    $obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    $obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    $obj_pdf->SetFont('helvetica', '', 9);
    $obj_pdf->setFontSubsetting(false);
    $obj_pdf->AddPage();
    //ob_start();
    // we can have any view part here like HTML, PHP etc
    //$content = ob_get_contents();
    ob_end_clean();
    $obj_pdf->writeHTML($content, true, false, true, false, '');
    $obj_pdf->Output('output.pdf', 'I');
}
开发者ID:anandcyberlinks,项目名称:cyberlinks-demo,代码行数:26,代码来源:pdf_helper.php

示例10: processing

 function processing($contextData, $options)
 {
     $prodId = $contextData[0]['id'];
     $prodName = $contextData[0]['name'];
     $unitPrice = $contextData[0]['unitprice'];
     $pFile = $contextData[0]['photofile'];
     $timestamp = new DateTime();
     $tsString = $timestamp->format("Y-m-d H:i:s");
     $fileName = "{$prodId}.pdf";
     require_once './tcpdf/tcpdf.php';
     $pdf = new TCPDF("P", "mm", "A4", true, "UTF-8");
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetMargins(0, 0, 0, 0);
     $pdf->AddPage();
     $pdf->setTextColor(100, 100, 100);
     $pdf->SetFont('', '', 14);
     $pdf->Text(40, 40, "Product ID: {$prodId}");
     $pdf->Text(40, 50, "Product Name: {$prodName}");
     $pdf->Text(40, 60, "Unit Price: {$unitPrice}");
     $pdf->Text(40, 70, "Today: {$tsString}");
     $pdf->Image("../Sample_products/images/{$pFile}", 40, 80, 100);
     header("Content-Type: application/pdf");
     header("Content-Disposition: attachment; filename=\"{$fileName}\"");
     header('X-Frame-Options: SAMEORIGIN');
     $pdf->Output();
 }
开发者ID:haya-sann,项目名称:INTER-Mediator,代码行数:27,代码来源:PDFSample.php

示例11: indexAction

 public function indexAction(Request $request, SessionInterface $session)
 {
     Util::checkUserIsLoggedInAndRedirect();
     $loggedInUserId = $session->get('user/id');
     $pageId = $request->get('id');
     $page = $this->getRepository(Entity::class)->getById($pageId, $loggedInUserId);
     // 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);
     $pdf->setPrintHeader(false);
     //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 font
     $pdf->SetFont('dejavusans', '', 10);
     // add a page
     $pdf->AddPage();
     $html = $page['content'];
     $pdf->writeHTML($html, true, false, true, false, '');
     // Close and output PDF document
     $pdf->Output('./../../' . $page['name'] . '.pdf', 'D');
 }
开发者ID:spiasecki,项目名称:ubirimi,代码行数:29,代码来源:EntityExportPdfController.php

示例12: pdf

 /**
  * @param string $html 要转为pdf的内容
  * @param string $filename 文件名
  * @param string $type 'I'在页面中显示;'D'直接下载
  */
 public static function pdf($html, $filename = 'hzd.pdf', $type = 'I')
 {
     import("Tools.TCPDF.TCPDF");
     import("Tools.TCPDF.config.tcpdf_config.php");
     $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('HZD');
     $pdf->SetTitle('HZD');
     $pdf->SetSubject('HZD');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     $pdf->setPrintHeader(false);
     //不显示头部
     $pdf->setPrintFooter(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 font
     $pdf->SetFont('stsongstdlight', '', 20);
     // add a page
     $pdf->AddPage();
     // output the HTML content
     $pdf->writeHTML($html, true, false, true, false, '');
     // ---------------------------------------------------------
     //Close and output PDF document
     $pdf->Output($filename, $type);
 }
开发者ID:hzd1989,项目名称:tcpdf,代码行数:40,代码来源:Pdf.class.php

示例13: 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;
 }
开发者ID:xepan,项目名称:commerce,代码行数:27,代码来源:RenderCalendar.php

示例14: generatePDF

 /**
  * Method creates a PDF in landscape mode, using ilPDFGeneration Job
  * Rest of method similar to superclass method
  *
  * @param ilPDFGenerationJob $job
  */
 public static function generatePDF(ilPDFGenerationJob $job)
 {
     // create new PDF document
     // 'L' for Landscape
     $pdf = new TCPDF('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator($job->getCreator());
     $pdf->SetAuthor($job->getAuthor());
     $pdf->SetTitle($job->getTitle());
     $pdf->SetSubject($job->getSubject());
     $pdf->SetKeywords($job->getKeywords());
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetMargins($job->getMarginLeft(), $job->getMarginTop(), $job->getMarginRight());
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->SetAutoPageBreak($job->getAutoPageBreak(), $job->getMarginBottom());
     $pdf->setImageScale($job->getImageScale());
     $pdf->SetFont('dejavusans', '', 10);
     foreach ($job->getPages() as $page) {
         $pdf->AddPage();
         $pdf->writeHTML($page, true, false, true, false, '');
     }
     $result = $pdf->Output($job->getFilename(), $job->getOutputMode());
     // (I - Inline, D - Download, F - File)
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:33,代码来源:class.ilRoomSharingTCPDFGenerator.php

示例15: Output

 public function Output($name = '', $dest = 'I')
 {
     if ($dest == 'I' || $dest == 'D' || !$dest && !$name) {
         header('Accept-Ranges: none');
     }
     return parent::Output($name, $dest);
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:7,代码来源:TcPdf.php


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