include_once "header.php"; require_once(TADTOOLS_PATH.'/tcpdf/tcpdf.php'); $pdf = new TCPDF("P", "mm", "A4", true, 'UTF-8', false); //PDF內容設定 $pdf->Output('通訊錄.pdf', 'D');
$pdf->setPrintHeader(false); //不要頁首 $pdf->setPrintFooter(false); //不要頁尾 $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //設定自動分頁 $pdf->setFontSubsetting(true); //產生字型子集(有用到的字才放到文件中) $pdf->SetFont('droidsansfallback', '', 12, '', true); //設定字型 $pdf->AddPage(); //新增頁面
$pdf->writeHTML($html, $ln=1, $fill=0, $reseth=true, $cell =true, $align='');
<img src="../images/logo_example.png" border="0" height="41" width="41" />
$pdf->SetMargins(20, 25); $pdf->setHeaderMargin(10); //頁首上方與頁面頂端的距離 $pdf->setFooterMargin(20); //頁尾上方與頁面尾端的距離
$pdf->setHeaderData($ln='', $lw=0, $ht='', $hs='', $tc=array(0, 0, 0), $lc=array(0, 0, 0)); $pdf->setFooterData($tc=array(0, 0, 0), $lc=array(0, 0, 0));
$pdf->setHeaderFont(array('droidsansfallback', '', 12)); $pdf->setFooterFont(array('droidsansfallback', '', 12));
$pdf->Cell($w, $h, $txt, $border, $ln, $align, $fill, $link, $stretch, $ignore_min_height, $calign, $valign); $pdf->MultiCell($w, $h, $txt, $border, $align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml, $autopadding, $maxh, $valign, $fitcell); $pdf->writeHTMLCell($w, $h, $x, $y, $html, $border, $ln, $fill, $reseth, $align, autopadding);
$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
$pdf->Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array());
<?php include_once "header.php"; $dir_name = "phone_book"; $filename = "my_data.zip"; //---------------底下不用改-------------------// $zip_dir = XOOPS_ROOT_PATH . "/uploads/{$dir_name}"; $file = XOOPS_ROOT_PATH . "/uploads/{$filename}"; $file_url = XOOPS_URL . "/uploads/{$filename}"; mk_dir($zip_dir); if (file_exists($file)) { unlink($file); } $msg = shell_exec("zip -r -j $file $zipdir"); if (file_exists($file)) { header("location: {$file_url}"); } else { include_once 'class/pclzip.lib.php'; $zipfile = new PclZip($file); $v_list = $zipfile->create($zip_dir , PCLZIP_OPT_REMOVE_PATH, $zip_dir); if ($v_list == 0) { die("Error : " . $zipfile->errorInfo(true)); } else { header("location: {$file_url}"); } } delete_directory($zip_dir); mk_dir($zip_dir); exit; function delete_directory($dirname) { if (is_dir($dirname)) { $dir_handle = opendir($dirname); } if (!$dir_handle) { return false; } while ($file = readdir($dir_handle)) { if ($file != "." && $file != "..") { if (!is_dir($dirname . "/" . $file)) { unlink($dirname . "/" . $file); } else { delete_directory($dirname . '/' . $file); } } } closedir($dir_handle); rmdir($dirname); return true; }