本文整理汇总了PHP中TCPDF::writeHTMLCell方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::writeHTMLCell方法的具体用法?PHP TCPDF::writeHTMLCell怎么用?PHP TCPDF::writeHTMLCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::writeHTMLCell方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPdfOutput
public function testPdfOutput()
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 001');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 001', PDF_HEADER_STRING, array(0, 64, 255), array(0, 64, 128));
$pdf->setFooterData(array(0, 64, 0), array(0, 64, 128));
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// 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 text shadow effect
$pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal'));
// Set some content to print
$html = <<<EOD
<h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;"> <span style="color:black;">TC</span><span style="color:white;">PDF</span> </a>!</h1>
<i>This is the first example of TCPDF library.</i>
<p>This text is printed using the <i>writeHTMLCell()</i> method but you can also use: <i>Multicell(), writeHTML(), Write(), Cell() and Text()</i>.</p>
<p>Please check the source code documentation and other examples for further information.</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>
EOD;
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
$this->comparePdfs($pdf);
}
示例2: 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');
}
示例3: order
public function order($order_id)
{
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('KHANSA TRADER');
$pdf->SetTitle('Surat perjanjian');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
require_once dirname(__FILE__) . '/lang/eng.php';
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', '', 10);
// add a page
$pdf->AddPage();
$html = pdf_view($order_id);
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, 'J', true);
$pdf->lastPage();
$pdf->Output('KHANSA-TRADER - Surat perjanjian.pdf', 'I');
}
示例4: pdfthongkeAction
//.........这里部分代码省略.........
</td>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="3" class="ten-bang-luong uppercase">BẢNG CHẤM CÔNG VÀ XẾP LOẠI A,B,C THÁNG ' . $thang . '-' . $nam . '</td>
</tr>';
$text_outout .= '<tr>
<td colspan="3">
<br/>
<table border="1" class="noi-dung" cellpadding="5" nobr="true">
<tr>
<td style="width: 25pt;" rowspan="2"><strong>STT</strong></td>
<td style="width: 70pt;" rowspan="2"><strong>HỌ TÊN</strong></td>
<td colspan="31" style="text-align:center;"><strong>Ngày Công Trong Tháng</strong></td>
<td style="width: 50pt;" rowspan="2"><strong>Phân loại A,B,C</strong></td>
<td style="width: 50pt;" rowspan="2"><strong>Ghi chú</strong></td>
</tr>
<tr>';
for ($i = 1; $i <= 31; $i++) {
$text_outout .= '<td >' . $i . '</td>';
}
$text_outout .= '</tr>';
$k = 0;
$chamcongModel = new Front_Model_ChamCong();
foreach ($list_nhan_vien as $nhan_vien) {
$phan_loai_label = 'A';
$phan_loai = $this->view->viewGetPhanLoai($nhan_vien->em_id, $thang, $nam);
if ($phan_loai) {
$phan_loai_label = $phan_loai->dg_ptccb_status;
if (!$phan_loai_label || $phan_loai_label == null || $phan_loai_label == '-') {
$phan_loai_label = 'A';
}
} else {
$phan_loai_label = '';
}
$text_outout .= '<tr>';
$k++;
$cham_cong = $chamcongModel->fetchOneData(array('c_em_id' => $nhan_vien['em_id'], 'c_thang' => (int) $thang, 'c_nam' => (int) $nam));
$text_outout .= '<td>' . $k . '</td>';
$text_outout .= '<td>' . $nhan_vien->em_ho . ' ' . $nhan_vien->em_ten_dem . ' ' . $nhan_vien->em_ten . '</td>';
for ($i = 1; $i <= 31; $i++) {
$ngay_chamcong = 'c_ngay_' . $i;
$trangthai_ngaycong = $cham_cong->{$ngay_chamcong};
$status = !empty($listHoliday[$trangthai_ngaycong]) ? $listHoliday[$trangthai_ngaycong] : ' ';
$text_outout .= '<td ' . $this->view->viewCheckChuNhatThuBay($i, (int) $thang, (int) $nam) . '>' . $status . '</td>';
}
$text_outout .= '<td>' . $phan_loai_label . '</td>';
$text_outout .= '<td></td>';
$text_outout .= '</tr>';
}
$text_outout .= '</table>
</td>
</tr>';
$text_outout .= '</table>
</td>
</tr>';
$text_outout .= '<tr><td style=""></td><td style="width: 120pt;"> </td><td style="width: 50pt;"> </td></tr>';
foreach ($holidays as $holiday) {
$text_outout .= '<tr class="noi-dung"><td style="width: 32pt;"></td><td style="width: 70pt;">' . $holiday['hld_name'] . '</td><td style="width: 50pt;">' . $holiday['hld_code'] . '</td></tr>';
}
$text_outout .= '</table> ';
$pdf->writeHTMLCell(0, 0, '', '', $text_outout, 0, 1, 0, true, '', true);
$pdf->Output($file_name, 'I');
die;
$k += 5;
foreach ($holidays as $holiday) {
$k++;
$objPHPExcel->getActiveSheet()->SetCellValue('B' . ($k + 7), $holiday['hld_name']);
$objPHPExcel->getActiveSheet()->SetCellValue('C' . ($k + 7), $holiday['hld_code']);
}
if ($k) {
$objPHPExcel->getActiveSheet()->setTitle('Bảng lương');
if ($pb_selected && $phong_ban_selected_info) {
$file_name = 'Thong_ke_luong_' . str_replace(' ', '_', $this->loc_tieng_viet($phong_ban_selected_info->pb_name)) . '_' . $thang . '-' . $nam . '.xls';
} else {
$file_name = 'Thong_ke_luong_' . $thang . '-' . $nam . '.xls';
}
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;
filename = "' . $file_name . '"');
header('Cache-Control: max-age = 0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
die;
/*
$file_name = 'Bang_luong_.xls';
$objPHPExcel->getActiveSheet()->setTitle('Bảng lương');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="hungnm.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output'); */
} else {
$this->_helper->viewRenderer->setRender('loi');
}
} else {
$this->_helper->viewRenderer->setRender('loi');
}
}
示例5: strlen
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
//initialize document
$pdf->AliasNbPages();
// add a page
$pdf->AddPage();
// ---------------------------------------------------------
// set font
$pdf->SetFont("arialunicid0", "B", 12);
//B= bold , I = Italic , U = Underlined
//Document Header
//Line1
$slen = strlen(dPgetConfig('company_name') . "\n") + $str_pad;
$pdf->writeHTMLCell($header_w + $slen, $header_h, $x, $y, dPgetConfig('company_name'));
$pdf->writeHTMLCell($header_w, $header_h, $x + $slen, $y, date("Y/m/d"));
// (Width,Height,Text,Border,Align,Fill,Line,x,y,reset,stretch,ishtml,autopadding,maxh)
// Line break - Line2
$y = $y + $header_line_gap;
// set font
$pdf->SetFont("", "B", 12);
// Title
$slen = mb_strlen($AppUI->_('Project Overdue Task Report')) + $str_pad;
$pdf->writeHTMLCell($header_w + $slen, $header_h, $x, $y, $AppUI->_('Project Overdue Task Report'));
// Line break - Line3
$y = $y + $header_line_gap;
$slen = mb_strlen($date->format($df) . " " . $AppUI->_('Tasks Due to be Completed By')) + $str_pad + 20;
$pdf->writeHTMLCell($header_w + $slen, $header_h, $x, $y, $date->format($df) . " " . $AppUI->_('Tasks Due to be Completed By'));
// Line break - Line4
$y = $y + $header_line_gap;
示例6: __construct
public function __construct(TCPDF $pdf, $title, $slogan, $name, $details)
{
$pdf->SetTextColor(255, 255, 255);
$pdf->SetFont('AlegreyaSans-ExtraBold', '', 25, '', true);
$pdf->writeHTMLCell(172, 100, 22, 242, $this->buildHTML('h2', $name, 30), 0, 1, 0);
$pdf->SetFont('AlegreyaSans-Regular', '', 16, '', true);
$pdf->writeHTMLCell(172, 100, 22, 255, $this->buildHTML('p', $details, 20), 0, 1, 0);
}
示例7: testPdfOutput
public function testPdfOutput()
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 007');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 007', 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 (optional)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', '', 12);
// add a page
$pdf->AddPage();
// create columns content
$left_column = '<b>LEFT COLUMN</b> left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column left column';
$right_column = '<b>RIGHT COLUMN</b> right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column right column';
// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
// get current vertical position
$y = $pdf->getY();
// set color for background
$pdf->SetFillColor(255, 255, 200);
// set color for text
$pdf->SetTextColor(0, 63, 127);
// write the first column
$pdf->writeHTMLCell(80, '', '', $y, $left_column, 1, 0, 1, true, 'J', true);
// set color for background
$pdf->SetFillColor(215, 235, 255);
// set color for text
$pdf->SetTextColor(127, 31, 0);
// write the second column
$pdf->writeHTMLCell(80, '', '', '', $right_column, 1, 1, 1, true, 'J', true);
// reset pointer to the last page
$pdf->lastPage();
$this->comparePdfs($pdf);
}
示例8: __construct
public function __construct(TCPDF $pdf, $title, $slogan, $name, $details)
{
$pdf->SetTextColor(255, 255, 255);
$pdf->SetFont('league-gothic', '', 100, '', true);
$pdf->writeHTMLCell(200, 200, 18, 35, $this->buildHTML('h1', $title), 0, 1, 0);
$pdf->SetFont('league-gothic', '', 70, '', true);
$pdf->writeHTMLCell(80, 200, 130, 135, $this->buildHTML('p', $slogan, 80), 0, 1, 0);
$pdf->SetFont('AlegreyaSans-ExtraBold', '', 25, '', true);
$pdf->writeHTMLCell(120, 100, 18, 241, $this->buildHTML('h2', $name, 30), 0, 1, 0);
$pdf->SetFont('AlegreyaSans-Regular', '', 16, '', true);
$pdf->writeHTMLCell(175, 100, 18, 254, $this->buildHTML('p', $details, 20), 0, 1, 0);
}
示例9: __construct
public function __construct(TCPDF $pdf, $title, $slogan, $name, $details)
{
$pdf->SetTextColor(255, 255, 255);
$pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.5, 'depth_h' => 0.5, 'color' => array(0, 0, 0), 'opacity' => 0.5, 'blend_mode' => 'Multiply'));
$pdf->SetFont('league-gothic', '', 100, '', true);
$pdf->writeHTMLCell(170, 200, 20, 40, $this->buildHTML('h1', $title), 0, 1, 0, true, 'C');
$pdf->SetFont('AlegreyaSans-MediumItalic', '', 55, '', true);
$pdf->writeHTMLCell(170, 200, 20, 63, $this->buildHTML('p', $slogan, 65), 0, 1, 0, true, 'C');
$pdf->setTextShadow(array('enabled' => false));
$pdf->SetFont('AlegreyaSans-ExtraBold', '', 25, '', true);
$pdf->writeHTMLCell(180, 100, 18, 241, $this->buildHTML('h2', $name, 30), 0, 1, 0);
$pdf->SetFont('AlegreyaSans-Regular', '', 16, '', true);
$pdf->writeHTMLCell(180, 100, 18, 254, $this->buildHTML('p', $details, 20), 0, 1, 0);
}
示例10: __construct
public function __construct(TCPDF $pdf, $title, $slogan, $name, $details)
{
$pdf->SetTextColor(23, 48, 80);
$pdf->SetFont('league-gothic', '', 100, '', true);
$pdf->writeHTMLCell(170, 200, 20, 40, $this->buildHTML('h1', $title), 0, 1, 0, true, 'C');
$pdf->SetTextColor(51, 81, 71);
$pdf->SetFont('AlegreyaSans-MediumItalic', '', 55, '', true);
$pdf->writeHTMLCell(170, 200, 20, 67, $this->buildHTML('p', $slogan, 65), 0, 1, 0, true, 'C');
$pdf->SetTextColor(255, 255, 255);
$pdf->SetFont('AlegreyaSans-ExtraBold', '', 30, '', true);
$pdf->writeHTMLCell(170, 100, 20, 225, $this->buildHTML('h2', $name, 35), 0, 1, 0, true, 'C');
$pdf->SetFont('AlegreyaSans-Regular', '', 18, '', true);
$pdf->writeHTMLCell(170, 100, 20, 245, $this->buildHTML('p', $details, 25), 0, 1, 0, true, 'C');
}
示例11: __construct
public function __construct(TCPDF $pdf, $title, $slogan, $name, $details)
{
$pdf->SetTextColor(255, 255, 255);
$pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.5, 'depth_h' => 0.5, 'color' => array(0, 0, 0), 'opacity' => 0.5, 'blend_mode' => 'Multiply'));
$pdf->SetFont('BubblegumSans', '', 85, '', true);
$pdf->writeHTMLCell(170, 200, 20, 35, $this->buildHTML('h1', $title), 0, 1, 0, true, 'C');
$pdf->SetTextColor(247, 220, 102);
$pdf->SetFont('BubblegumSans', '', 48, '', true);
$pdf->writeHTMLCell(80, 200, 110, 55, $this->buildHTML('p', $slogan, 58), 0, 1, 0, true, 'C');
$pdf->SetTextColor(0, 0, 0);
$pdf->setTextShadow(array('enabled' => false));
$pdf->SetFont('AlegreyaSans-ExtraBold', '', 25, '', true);
$pdf->writeHTMLCell(180, 100, 18, 243, $this->buildHTML('h2', $name, 30), 0, 1, 0);
$pdf->SetFont('AlegreyaSans-Regular', '', 16, '', true);
$pdf->writeHTMLCell(180, 100, 18, 256, $this->buildHTML('p', $details, 20), 0, 1, 0);
}
示例12: prepareFundingStatusReport
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');
}
示例13: testPdfOutput
public function testPdfOutput()
{
$this->markTestIncomplete('Repository excludes pdfahelvetica font.');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, true);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 065');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 065', 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 (optional)
$pdf->setLanguageArray($this->langSettings);
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
$pdf->SetFont('helvetica', '', 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 = <<<EOD
<h1>Example of <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;"> <span style="color:black;">TC</span><span style="color:white;">PDF</span> </a> document in <span style="background-color:#99ccff;color:black;"> PDF/A-1b </span> mode.</h1>
<i>This document conforms to the standard <b>PDF/A-1b (ISO 19005-1:2005)</b>.</i>
<p>Please check the source code documentation and other examples for further information (<a href="http://www.tcpdf.org">http://www.tcpdf.org</a>).</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>
EOD;
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
// ---------------------------------------------------------
$this->comparePdfs($pdf);
}
示例14: create_pdf
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;
}
示例15: generatePdf
/**
* @param string $content
* @param string $destination
* @return string
*/
public function generatePdf($content, $destination)
{
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false, true);
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetTitle($this->getFileName());
$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->setFontSubsetting(true);
$pdf->SetFont('helvetica', '', 9, '', true);
$pdf->AddPage();
$pdf->writeHTMLCell(0, 0, '', '', $content, 0, 1, 0, true, '', true);
$pdf->Output($destination, 'F');
return $destination;
}