ʹÓÃPHPµÄTCPDF¿âÉú³ÉPDFÎĵµ
ʵ¼Ê¹¤×÷ÖУ¬ÎÒÃÇҪʹÓÃPHP¶¯Ì¬µÄ´´½¨PDFÎĵµ£¬Ä¿Ç°ÓÐÐí¶à¿ªÔ´µÄPHP´´½¨PDFµÄÀà¿â£¬½ñÌìÎÒ¸ø´ó¼ÒÀ´½éÉÜÒ»¿îÓÅÐãµÄPDF¿â£¬Ëü¾ÍÊÇTCPDF£¬TCPDFÊÇÒ»¸öÓÃÓÚ¿ìËÙÉú³ÉPDFÎļþµÄPHP5º¯Êý°ü¡£TCPDF»ùÓÚFPDF½øÐÐÀ©Õ¹ºÍ¸Ä½ø£¬ÔöÇ¿ÁËʵÓù¦ÄÜ¡£
ÌØÐÔ
TCPDF¾ßÓÐÒÔÏÂÌØÐÔ£º
1¡¢Ö§³Ö±í¸ñ£»
2¡¢Ö§³ÖHTML±êÇ©´úÂ룻
3¡¢Ö§³ÖÒ³ÃæÒ³½Å£»
4¡¢Ö§³Öjpg/png/gif/svgͼÐÎͼÏñ£»
5¡¢Ö§³ÖÖÐÎÄ×Ö·û£»£¨ÓÐЩPDFÀ಻֧³ÖÖÐÎÄ»òÕß´¦ÀíÖÐÎÄÏ൱Âé·³£©
6¡¢×Ô¶¯·ÖÒ³£¬×Ô¶¯Ò³Â룬µÈµÈ¡£
ÈçºÎʹÓÃ
Äú¿ÉÒÔ´ÓTCPDF¹ÙÍø»ñÈ¡×îа汾£ºhttp://www.tcpdf.org¡£¹ÙÍøÌṩÁ˼¸Ê®¸öʾÀýÒÔ¼°ËµÃ÷Îĵµ£¬ÏÂÔؽâѹºóÒ»¶¨Òª×¢ÒâÎļþ·¾¶£¬ÈçºÎʹÓÃTCPDF£¬¿ÉÒÔ´ÓÒÔÏÂ5¸ö²½ÖèÍê³É£º
1¡¢require_onceµ¼Èëtcpdf.phpÎļþ¼°Ïà¹ØÅäÖÃÐÅÏ¢£»
2¡¢ÊµÀý»¯TCPDF£»
3¡¢ÉèÖÃPDFÎĵµµÄ¸ñʽ£¬°üÀ¨ÎĵµÐÅÏ¢¡¢Ò³Ã¼¡¢Ò³Î²¡¢×ÖÌå¡¢Íâ¼ä¾à¡¢Í¼Æ¬±ß¿ò¡¢·ÖÒ³µÈ£»
4¡¢µ¼ÈëPDFÎĵµµÄÄÚÈÝ£¬¿ÉÒÔÊǵ¥Ðлò¶àÐмòµ¥×Ö·û´®£¬Ò²¿ÉÒÔHTML¸ñʽµÄ×Ö·û´®µÈ£»
5¡¢Êä³öPDFÎĵµ¡£
ʾÀý´úÂë
<?php require_once('tcpdf.php'); //ʵÀý»¯ $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false); // ÉèÖÃÎĵµÐÅÏ¢ $pdf->SetCreator('it300.com'); $pdf->SetAuthor('it300.com'); $pdf->SetTitle('Welcome to it300.com!'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, PHP'); // ÉèÖÃҳüºÍÒ³½ÅÐÅÏ¢ $pdf->SetHeaderData('logo.png', 30, 'it300.com', 'ºÆº£´úÂëÍø£¬ÖÂÁ¦ÓÚ×ö×îʵÓõĴúÂëÍø¡£', array(0,64,255), array(0,64,128)); $pdf->setFooterData(array(0,64,0), array(0,64,128)); // ÉèÖÃҳüºÍÒ³½Å×ÖÌå $pdf->setHeaderFont(Array('stsongstdlight', '', '10')); $pdf->setFooterFont(Array('helvetica', '', '8')); // ÉèÖÃĬÈϵȿí×ÖÌå $pdf->SetDefaultMonospacedFont('courier'); // ÉèÖüä¾à $pdf->SetMargins(15, 27, 15); $pdf->SetHeaderMargin(5); $pdf->SetFooterMargin(10); // ÉèÖ÷ÖÒ³ $pdf->SetAutoPageBreak(TRUE, 25); // set image scale factor $pdf->setImageScale(1.25); // set default font subsetting mode $pdf->setFontSubsetting(true); //ÉèÖÃ×ÖÌå $pdf->SetFont('stsongstdlight', '', 14); $pdf->AddPage(); $str1 = '»¶ÓÀ´µ½ºÆº£´úÂëÍø£¬http://www.it300.com'; $pdf->Write(0,$str1,'', 0, 'L', true, 0, false, false, 0); //Êä³öPDF $pdf->Output('t.pdf', 'I'); ?>
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ