require_once('./tcpdf/tcpdf.php');
$pdf = new TCPDF('L', 'mm', 'A4', true, 'UTF-8', false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->AddPage();
$pdf->Image('./post.png', '', '', 210, '', 'PNG', '', '', true, 300, '', false, false, 0, false, false, false);
$pdf->SetFont('msungstdlight', '', 28);
$pdf->SetXY(16, 16);
$pdf->Write(0,'1 2 3 4 5 6 7 8');
$pdf->SetFont('msungstdlight', '', 28);
$pdf->SetXY(123, 19);
$pdf->Write(0,'2 6 0 0');
$pdf->SetFont('msungstdlight', '', 20);
$pdf->SetXY(84, 31);
$pdf->Write(0,'XXXX基金會');
$pdf->SetFont('msungstdlight', '', 14);
$pdf->SetXY(10, 30);
$msg = '
【客戶資料】
姓名:測試用
電話:0900000000
【訂單資料】
Ax1000
Bx1000';
$pdf->Write(0, $msg);
$pdf->Output('example.pdf', 'I');
We are the Priests of the Temples of Syrinx, our great computers fill the hallowed halls.
2012-04-10
PHP 產生 PDF 郵政劃撥單
採用 TCPDF 輸出 PDF,先把劃撥單圖檔放上,再用 SetXY 設定座標後填上字。劃撥單可至郵局下載,建議輸出成 150dpi 的圖檔之後轉 pdf 會比較清楚。
2011-10-26
CKEditor + KCFinder 筆記
CKEditor 的 config.js 中加入
config.filebrowserBrowseUrl = 'lib/kcfinder/browse.php?type=files'; config.filebrowserImageBrowseUrl = 'lib/kcfinder/browse.php?type=images'; config.filebrowserFlashBrowseUrl = 'lib/kcfinder/browse.php?type=flash'; config.filebrowserUploadUrl = 'lib/kcfinder/upload.php?type=files'; config.filebrowserImageUploadUrl = 'lib/kcfinder/upload.php?type=images'; config.filebrowserFlashUploadUrl = 'lib/kcfinder/upload.php?type=flash';KCFinder 的 config.php 設定 session,user 登入後再設定 $_SESSION['mysite']['KCFINDER']['disabled'] = false;
'_sessionVar' => &$_SESSION['mysite']['KCFINDER'],要放在 jQuery UI 的 dialog 中時忘記遇到什麼問題,後來改成在 dialog open 時才將 ckeditor 載入,dialog close 時再清掉。
$("#dialog-news").dialog({
open: function () {
$(this).find('textarea').ckeditor({height:360});
},
close: function () {
$(this).find('textarea').val('').ckeditorGet().destroy();
}
});
嵌入 KCFinder (例如按下某個 button 後跳出 KCFinder browser 的視窗,選擇檔案後返回)$('#dialog-news button[name="attach"]').click(function(){
window.KCFinder = {
callBack: function(url) {
window.KCFinder = null;
$('#dialog-news input[name="link"]').val('.'+url);
}
};
window.open('lib/kcfinder/browse.php?type=files&dir=files/attachment', 'kcfinder_textbox',
'status=0, toolbar=0, location=0, menubar=0, directories=0, ' +
'resizable=1, scrollbars=0, width=800, height=600'
);
return false;
});
KCFinder 上傳檔案改成 time stamp 加檔名,修改 core/uploader.php 中 public function upload()$filename = date('YmdHis') . '-' . $this->normalizeFilename($file['name']);
$target = file::getInexistantFilename($dir . $filename);
2010-01-14
Lifetype + APC
有人反應修改 lifetype template 後在 blog 上沒有改變,想說近期只有把 eAccelerator 換成 APC,去 apc 管理介面看果然 template 都被 cache 住了,第一次用 apc 沒注意到這個問題,不過感覺上應該要知道 template 有改變過才是(?),懶得研究 apc cache、lifetype/tmp、template 間的關係,直接用 google 找 apc lifetype template,很失望的看了幾頁都沒人遇到這問題,乾脆去看 APC 手冊比較快。其中有個 apc.filters string,可以用 reg exp 設定哪些檔案不要 cache,直接在 php.ini 的 apc 部分加入
apc.filters= .template.php
重開 apache,清 apc chahe 後果然就沒問題了~ 話說,裝了 APC 後感覺真的快很多。
訂閱:
文章 (Atom)
