2 rcs_id('$Id: pdf.php,v 1.1 2004-03-26 00:22:37 rurban Exp $');
4 // PDF functions taken from FPDF http://www.fpdf.org
5 // Edited for PHPWebthings by Don SebĂ
6 // Feel free to edit , enhance the module, and please share it at http://www.phpdbform.com
7 // Keep PHPWT COOL submit your modules/themes/mods, it will help to improve ! :)
9 require_once('lib/fpdf.php');
11 class PDF extends FPDF {
17 function PDF ($orientation='P', $unit='mm', $format='A4') {
18 $this->FPDF($orientation,$unit,$format);
21 // Simple HTML to PDF converter
22 function ConvertFromHTML($html) {
23 $html = str_replace("\n",' ',$html);
24 $a = preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
25 foreach($a as $i=>$e) {
29 $this->PutLink($this->HREF,$e);
35 $this->CloseTag(strtoupper(substr($e,1)));
37 //Filter de attributen
38 $a2 = explode(' ',$e);
39 $tag = strtoupper(array_shift($a2));
42 if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3))
43 $attr[strtoupper($a3[1])]=$a3[2];
44 $this->OpenTag($tag,$attr);
52 //URL - space from side - space from top - width
53 $imgurl = "..."; // header and wikilogo
54 $this->Image($imgurl,3,3,$imgwidth);
61 //global $cfg, $config, $lang;
62 //Positie 1.5 cm van de onderkant
65 $this->SetFont('Arial','I',8);
67 //$this->Cell(0,10,$cfg["core"]["url"],0,0,'C');
68 //$this->Cell(0,10,' Page '.$this->PageNo().'/{nb}',0,0,'C');
71 function OpenTag($tag,$attr) {
72 if($tag=='B' or $tag=='I' or $tag=='U')
73 $this->SetStyle($tag,true);
75 $this->HREF=$attr['HREF'];
80 function CloseTag($tag) {
81 if($tag=='B' or $tag=='I' or $tag=='U')
82 $this->SetStyle($tag,false);
87 //Wijzig stijl en selecteer lettertype
88 function SetStyle($tag,$enable) {
89 $this->$tag+=($enable ? 1 : -1);
91 foreach(array('B','I','U') as $s)
94 $this->SetFont('',$style);
97 function PutLink($URL,$txt) {
98 // hyperlink as simple underlined text
99 $this->SetTextColor(0,0,255);
100 $this->SetStyle('U',true);
101 $this->Write(5,$txt,$URL);
102 $this->SetStyle('U',false);
103 $this->SetTextColor(0);
111 // c-hanging-comment-ender-p: nil
112 // indent-tabs-mode: nil