Example #1
14
 function convertHtmlToPdf($html)
 {
     if (!$html) {
         throw new \Exception("Html Not Given");
     }
     $pagelayout = array($this->options['width'], $this->options['height']);
     //  or array($width,$height)
     $pdf = new \TCPDF('l', 'px', $pagelayout, true, 'UTF-8', false);
     $pdf->SetMargins(0, 0, 0);
     $pdf->SetHeaderMargin(0);
     $pdf->SetFooterMargin(0);
     // $pdf = new \TCPDF_TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetAutoPageBreak(false);
     if ($this->options['header_font_family']) {
         $pdf->SetFont($this->options['header_font_family']);
     }
     // add a page
     $pdf->AddPage();
     $pdf->WriteHTML($html, true, false, true, false);
     $this->pdf = $pdf->Output(null, 'S');
     //for test
     // $this->pdf = $pdf->Output(null);
     // echo $this->pdf;
     // exit;
 }
 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');
 }
Example #3
3
 /**
  * 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');
 }
 /**
  * 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');
 }
Example #5
1
File: pdf.php Project: tmlsoft/main
 /**
  * 初始化
  *
  * @access public
  * @param  array  $params 初始化参数
  * @return void
  */
 public function __construct($params)
 {
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor($this->pdf_author);
     $pdf->SetTitle($this->pdf_title);
     $pdf->SetSubject($this->pdf_subject);
     $pdf->SetKeywords($this->pdf_keywords);
     // 不显示头部和底部
     $pdf->setPrintHeader(FALSE);
     $pdf->setPrintFooter(FALSE);
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //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
     require TCPDF_BASE_PATH . 'tcpdf/config/lang/eng.php';
     $pdf->setLanguageArray($l);
     // set font
     $pdf->SetFont('stsongstdlight', '', 10);
     $pdf->AddPage();
     $pdf->writeHTML($params['content'], true, false, true, false, '');
     $pdf->lastPage();
     // 输出方式 I:浏览器直接输出 D:文件下载 如果需要浏览器输出或者下载的同时生成文件请在前面加上F
     $pdf->Output($params['filename'], $params['flag']);
 }
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');
}
/**
 * Creates an example PDF TEST document using TCPDF
 * @package com.tecnick.tcpdf
 * @abstract TCPDF - Example: Default Header and Footer
 * @author Nicola Asuni
 * @since 2008-03-04
 */
function citation_exporter_create_pdf($html_input, $output_filename)
{
    module_load_include('php', 'citation_exporter', '/lib/tcpdf/config/lang/eng');
    module_load_include('php', 'citation_exporter', '/lib/tcpdf/tcpdf');
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    //$pdf->SetCreator(PDF_CREATOR);
    //$pdf->SetAuthor('Nicola Asuni');
    //$pdf->SetTitle('Exported Citations');
    //$pdf->SetSubject('Citations');
    //$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
    // set default header data
    //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 001', PDF_HEADER_STRING);
    // set header and footer fonts
    //$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
    //$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    //set margins
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    //set auto page breaks
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    //set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    //set some language-dependent strings
    $pdf->setLanguageArray($l);
    // ---------------------------------------------------------
    // set default font subsetting mode
    $pdf->setFontSubsetting(true);
    // Set font
    // dejavusans is a UTF-8 Unicode font, if you only need to
    // print standard ASCII chars, you can use core fonts like
    // helvetica or times to reduce file size.
    $pdf->SetFont('dejavusans', '', 14, '', true);
    // Add a page
    // This method has several options, check the source code documentation for more information.
    $pdf->AddPage();
    // Print text using writeHTMLCell()
    $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $html_input, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
    // ---------------------------------------------------------
    // Close and output PDF document
    // This method has several options, check the source code documentation for more information.
    $pdf->Output($output_filename, 'F');
    //============================================================+
    // END OF FILE
    //============================================================+
}
Example #8
1
    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');
    }
Example #9
1
 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');
 }
Example #10
0
 /**
  * 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;
 }
Example #11
0
 static function printTicket($ticket_html, $order)
 {
     ob_end_clean();
     $config = JComponentHelper::getParams('com_bookpro');
     $page_ticket = "<h1 color='Red'> Wellcome to tcpdf </h1>";
     $page_ticket = $ticket_html;
     // create new PDF document
     $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
     $order_number = $order->order_number;
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Joombooking');
     $pdf->SetTitle('Travel Ticket ' . $order_number);
     $pdf->SetSubject('Travel Ticket');
     $pdf->SetKeywords('TCPDF, PDF, ticket, travel, booking');
     // set default header data
     //$pdf->SetHeaderData($config->get('company_logo'),50, $config->get('company_name'), "Ticket \n www.");
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     //$pdf->setHeaderMargin(10);
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set margins
     //$pdf->SetMargins(30, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     //$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     //set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     //set some language-dependent strings
     $pdf->setLanguageArray($l);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('times', '', 11);
     // add a page
     $pdf->AddPage();
     // set JPEG quality
     $pdf->setJPEGQuality(75);
     $style['position'] = 'R';
     /*
      *     $type type of barcode (see tcpdf_barcodes_1d.php for supported formats).
      *      
      */
     //$pdf->write1DBarcode($order_number, 'C128B','', '', '', 10, 0.4, $style, 'M');
     // create some HTML content
     //$pdf->writeHTML($htmlcontent, true, 0, true, 0);
     //$pdf->WriteHTML(file_get_contents('test.html'));
     $pdf->WriteHTML($page_ticket);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // reset pointer to the last page
     $pdf->lastPage();
     // ---------------------------------------------------------
     //Close and output PDF document
     ob_end_clean();
     $pdf->Output($order->name . '.pdf', 'I');
     //Should use variable to make file name
     ob_end_flush();
 }
Example #12
0
 /**
  * @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);
 }
Example #13
0
 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";
 }
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');
}
Example #15
0
 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();
 }
 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');
 }
 /**
  * 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)
 }
Example #18
0
 function display($tpl = null)
 {
     global $mainframe;
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $this->assignRef('params', $params);
     $user = JFactory::getUser();
     $username = $user->username;
     $this->child = JFactory::getUser($username);
     $layout = $params->get('layout');
     $this->tasks = JoomdleHelperContent::call_method("get_children_grade_user_report", $username);
     $tpl = "catspdf";
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     $this->_prepareDocument();
     $htmlcontent = parent::loadTemplate($tpl);
     require_once JPATH_SITE . '/libraries/tcpdf/tcpdf.php';
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $header = JText::_('COM_JOOMDLE_GRADES');
     $pdf->SetHeaderData('', 0, $header);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFontSubsetting(false);
     $pdf->SetFont('times', '', 8);
     // add a page
     $pdf->AddPage("L");
     // output the HTML content
     $pdf->writeHTML($htmlcontent, true, 0, true, 0);
     $pdf->Output("grades.pdf", 'D');
     exit;
 }
Example #19
0
 public function Output($name = '', $dest = 'I')
 {
     if ($dest == 'I' || $dest == 'D' || !$dest && !$name) {
         header('Accept-Ranges: none');
     }
     return parent::Output($name, $dest);
 }
Example #20
0
 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $this->assignRef('params', $params);
     $this->course_id = $params->get('course_id');
     if (!$this->course_id) {
         $this->course_id = JRequest::getVar('course_id');
     }
     $this->course_id = (int) $this->course_id;
     // Only for logged users
     $user = JFactory::getUser();
     $username = $user->username;
     if (!$username) {
         return;
     }
     if (!$this->course_id) {
         echo JText::_('COM_JOOMDLE_NO_COURSE_SELECTED');
         return;
     }
     $this->course_info = JoomdleHelperContent::getCourseInfo($this->course_id, $username);
     // user not enroled
     if (!$this->course_info['enroled']) {
         return;
     }
     $document = JFactory::getDocument();
     $document->setTitle($this->course_info['fullname'] . ': ' . JText::_('COM_JOOMDLE_GRADES'));
     $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx'));
     //  $this->gcats = JoomdleHelperContent::call_method ("get_course_grades_by_category", $this->course_id, $username);
     $this->gcats = JoomdleHelperContent::call_method("get_grade_user_report", $this->course_id, $username);
     $tpl = "catspdf";
     $this->_prepareDocument();
     $htmlcontent = parent::loadTemplate($tpl);
     require_once JPATH_SITE . '/libraries/tcpdf/tcpdf.php';
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $header = $this->course_info['fullname'];
     $header2 = JText::_('COM_JOOMDLEGRADES_TEACHER') . ': ' . $user->name;
     $header2 .= ' ' . JText::_('COM_JOOMDLEGRADES_DATE') . ': ' . date('d-m-Y');
     //	$pdf->SetHeaderData('', 0, $header, $header2);
     $pdf->SetHeaderData('', 0, $header);
     //set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFontSubsetting(false);
     $pdf->SetFont('times', '', 8);
     // add a page
     $pdf->AddPage("L");
     // output the HTML content
     $pdf->writeHTML($htmlcontent, true, 0, true, 0);
     $pdf->Output("grades.pdf", 'D');
     exit;
     //parent::display($tpl);
 }
 private function getPdfData()
 {
     $pdf = new \TCPDF();
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetFont('times', 'BI', 12);
     $pdf->AddPage();
     $pdf->Write(0, 'Fichier pdf', '', 0, 'C', true, 0, false, false, 0);
     return $pdf->Output('fichier.pdf', 'S');
 }
Example #22
0
 public function getPDFFile($array, $header = null)
 {
     // Output
     //        header("Content-type: text/x-csv");
     //        //header("Content-type: text/csv");
     //        //header("Content-type: application/csv");
     //        header("Cache-Control: maxage=3600");
     //        header("Pragma: public");
     //        header("Content-Disposition: attachment; filename = " . $this->filename . ".csv");
     $this->getPDFFromArray($array, $header);
     $this->pdf->Output($this->filename . '.pdf', 'I');
 }
function prepareFundingStatusReport($conn)
{
    require_once 'tcpdf/tcpdf.php';
    //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    $pdf = new TCPDF('L', PDF_UNIT, 'Letter', 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', '', 7);
    $pdf->AddPage($orientation = L, $format = 'Letter', $keepmargins = true, $tocpage = false);
    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/funding_status.svg';
    if (file_exists($filePath)) {
        unlink($filePath);
    }
    $file = fopen($filePath, "w");
    fwrite($file, $html);
    fclose($file);
    $pdf->ImageSVG($file = 'pdfslice/funding_status.svg', $x = 3, $y = 20, $w = 1291, $h = 400, $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/FundingStatusChart.pdf';
    if (file_exists($filePath)) {
        unlink($filePath);
    }
    $pdf->Output('pdfslice/FundingStatusChart.pdf', 'F');
}
Example #24
0
function create_pdf($campdata)
{
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->SetCreator('Dreamcity');
    $pdf->SetAuthor('Dreamcity');
    $pdf->SetTitle('TCPDF Example 001');
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    // set margins
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_RIGHT);
    // set auto page breaks
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    // set default font subsetting mode
    $pdf->setFontSubsetting(true);
    // Set font
    // dejavusans is a UTF-8 Unicode font, if you only need to
    // print standard ASCII chars, you can use core fonts like
    // helvetica or times to reduce file size.
    $pdf->SetFont('dejavusans', '', 14, '', true);
    // Add a page
    // This method has several options, check the source code documentation for more information.
    $pdf->AddPage();
    // Set some content to print
    $html = "<h1>Dear Dreamer</h1>\r\n<i>Here is a Copy of your previous application</i>\r\n<p></p>" . "<br/>" . $campdata->camp_description . "<br/>" . $campdata->camp_short_desc . "<br/>" . $campdata->camp_construction . "<br/>" . $campdata->camp_participants . "<br/>" . $campdata->camp_registration_date;
    // Print text using writeHTMLCell()
    $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
    // Close and output PDF document
    // This method has several options, check the source code documentation for more information.
    //$data = $pdf->Output('application.pdf', 'E');
    $data = $pdf->Output('application.pdf', 'S');
    //$data = array($fileatt);
    //$data = chunk_split($fileatt);
    /*
        //$fileatt = "./test.pdf";
    
        $fileatttype = "application/pdf";
        $fileattname = "newname.pdf";
    
        $file = fopen($fileatt, 'rb');
        $data = fread($file, filesize($fileatt));
    
        fclose($file);
    */
    return $data;
}
Example #25
0
 public function fromSvg($svgFile, $outputFile)
 {
     // Include the main TCPDF library (search for installation path).
     require_once dirname(__DIR__) . '/vendor/tcpdf/tcpdf.php';
     // create new PDF document
     $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Bixie');
     $pdf->SetTitle('');
     $pdf->SetSubject('');
     $pdf->SetKeywords('');
     // set default header data
     //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 058', PDF_HEADER_STRING);
     // set header and footer fonts
     //		$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     //		$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(0, 0, 0);
     $pdf->SetHeaderMargin(0);
     $pdf->SetFooterMargin(0);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', '', 10);
     // add a page
     $pdf->AddPage();
     // NOTE: Uncomment the following line to rasterize SVG image using the ImageMagick library.
     //$pdf->setRasterizeVectorImages(true);
     $pdf->ImageSVG($svgFile, $x = 0, $y = 0, $w = '', $h = '', $link = '', $align = '', $palign = '', $border = 0, $fitonpage = false);
     //		$pdf->SetFont('helvetica', '', 8);
     //		$pdf->SetY(195);
     //		$txt = '© The copyright holder of the above Tux image is Larry Ewing, allows anyone to use it for any purpose, provided that the copyright holder is properly attributed. Redistribution, derivative work, commercial use, and all other use is permitted.';
     //		$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
     // ---------------------------------------------------------
     //Close and output PDF document
     $pdf->Output($outputFile, 'F');
 }
 public static function generatePDF(ilPDFGenerationJob $job)
 {
     require_once 'tcpdf/tcpdf.php';
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator($job->getCreator());
     $pdf->SetAuthor($job->getAuthor());
     $pdf->SetTitle($job->getTitle());
     $pdf->SetSubject($job->getSubject());
     $pdf->SetKeywords($job->getKeywords());
     //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING); // TODO
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     // TODO
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // TODO
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // TODO
     $pdf->SetMargins($job->getMarginLeft(), $job->getMarginTop(), $job->getMarginRight());
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     // TODO
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // TODO
     $pdf->SetAutoPageBreak($job->getAutoPageBreak(), $job->getMarginBottom());
     $pdf->setImageScale($job->getImageScale());
     $pdf->SetFont('dejavusans', '', 10);
     // TODO
     /* // TODO
     		// 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
     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)
 }
 public function exporttopdf($title, $filename, $html)
 {
     Yii::import('application.extensions.tcpdf.*');
     require_once 'tcpdf/tcpdf.php';
     require_once 'tcpdf/config/lang/eng.php';
     ob_clean();
     $pdf = new TCPDF();
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor(Yii::app()->name);
     $pdf->SetTitle($title);
     $pdf->SetSubject($title);
     $pdf->SetKeywords('example, text, report');
     $pdf->SetHeaderData('', 0, "Student Report", '');
     //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, "");
     $pdf->setHeaderFont(array('helvetica', '', 8));
     $pdf->setFooterFont(array('helvetica', '', 6));
     $pdf->SetMargins(15, 18, 15);
     $pdf->SetHeaderMargin(5);
     $pdf->SetFooterMargin(10);
     $pdf->SetAutoPageBreak(TRUE, 15);
     $pdf->SetFont('dejavusans', '', 7);
     $resolution = array(150, 150);
     $pdf->AddPage('P', $resolution);
     $pdf->writeHTML($html, true, false, true, false, '');
     $pdf->LastPage();
     $pdf->Output($filename, "I");
 }
Example #28
-1
 public function print_pdf($text, $title = 'PDF Document')
 {
     require_once '../backend/tcpdf/tcpdf.php';
     $pdf = new TCPDF();
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->AddPage();
     $pdf->writeHTML($text, true, false, true, false, '');
     $pdf->Output($title, 'I');
 }
Example #29
-2
 public function save($file)
 {
     $orientation = $this->_getOrientation();
     $size = $this->_getSize();
     /* @TODO Not sure if this works either, in comparison with $pdf->AddPage() */
     $pdf = new TCPDF($orientation, 'mm', $size, true, $this->_page['encoding'], false);
     if (is_array($this->_page['size'])) {
         list($width, $height) = $this->_page['size'];
         $orientation = $height > $width ? 'P' : 'L';
         $pdf->addFormat("custom", $width, $height);
         $pdf->reFormat("custom", $orientation);
     }
     $pdf->SetAutoPageBreak(TRUE, $this->_page['margin'][2]);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $tagvs = array('p' => array(array('h' => 0, 'n' => 1), array('h' => '', 'n' => 1)), 'hr' => array(array('h' => 0, 'n' => 0), array('h' => 0, 'n' => 0)));
     $pdf->setHtmlVSpace($tagvs);
     //        $pdf->SetHeaderMargin(0);
     //        $pdf->SetFooterMargin(0);
     call_user_func_array(array($pdf, 'SetMargins'), $this->_page['margin']);
     foreach ($this->_html as $i => $page) {
         $page = (strpos($page, '<style') !== FALSE && strpos($page, '<style') < strpos($page, '<body') ? substr($page, strpos($page, '<style'), strpos($page, '</style') - strpos($page, '<st') + 8) : '') . preg_replace('/<body[^>]+>/i', '', substr($page, strpos($page, '<body'), strpos($page, '</body') - strpos($page, '<body')));
         $page = str_replace(array("\r", "\n"), "", $page);
         if (!is_array($size)) {
             $pdf->AddPage();
         } else {
             $pdf->AddPage($orientation, $size);
             // @TODO must verify if this is correct
         }
         $pdf->writeHTML($page, true, false, true, false);
         $pdf->lastPage();
     }
     //        $pdf->Output($file, 'I'); die();
     $pdf->Output($file, 'F');
 }
Example #30
-10
    function index()
    {
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        // 设置文档的基本信息
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('tongji');
        $pdf->SetTitle('下载');
        $pdf->SetSubject('打印文档');
        $pdf->SetKeywords('下载, 打印文档');
        // 默认页眉页脚
        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 023', PDF_HEADER_STRING);
        // 页眉页脚字体
        $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(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);
        // ---------------------------------------------------------
        // 设置中文字体
        $pdf->SetFont('droidsansfallback', 'BI', 14);
        // Start First Page Group
        $pdf->startPageGroup();
        // add a page
        $pdf->AddPage();
        // set some text to print
        $txt = <<<EOD
Example of page groups.
Check the page numbers on the page footer.

This is the first page of group 1.
EOD;
        // print a block of text using Write()
        $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);
        // add second page
        $pdf->AddPage();
        $pdf->Cell(0, 10, '发热551', 0, 1, 'L');
        // ---------------------------------------------------------
        //Bug出现下载文档
        //Close and output PDF document
        $pdf->Output('example_023.pdf', 'I');
    }